harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r394825 - in /incubator/harmony/enhanced/classlib/trunk/modules/regex: make/common/build.xml src/main/java/java/util/regex/Pattern.java src/test/java/tests/api/java/util/regex/PatternSyntaxExceptionTest.java
Date Tue, 18 Apr 2006 02:19:10 GMT
Author: mloenko
Date: Mon Apr 17 19:19:07 2006
New Revision: 394825

URL: http://svn.apache.org/viewcvs?rev=394825&view=rev
Log:
fix for HARMONY-352
tests/api/java/util/regex/PatternSyntaxExceptionTest is excluded

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/regex/make/common/build.xml
    incubator/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Pattern.java
    incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/tests/api/java/util/regex/PatternSyntaxExceptionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/regex/make/common/build.xml
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex/make/common/build.xml?rev=394825&r1=394824&r2=394825&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex/make/common/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex/make/common/build.xml Mon Apr
17 19:19:07 2006
@@ -94,11 +94,6 @@
 			<batchtest todir="${hy.tests.reports}" haltonfailure="no">
 				<fileset dir="${hy.regex.src.test.java}">
 					<include name="**/*Test.java"/>
-
-
-					<!-- Harmony exclude list -->
-					<exclude name="tests/api/java/util/regex/PatternSyntaxExceptionTest.java"/>
-
 				</fileset>
 			</batchtest>
 		</junit>

Modified: incubator/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Pattern.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Pattern.java?rev=394825&r1=394824&r2=394825&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Pattern.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/Pattern.java
Mon Apr 17 19:19:07 2006
@@ -592,7 +592,7 @@
                     if (lexemes.peek() != Lexer.CHAR_RIGHT_PARENTHESIS)
                         throw new PatternSyntaxException(I18n
                                 .getMessage("unmatched ("), lexemes.toString(),
-                                lexemes.getIndex());
+                                lexemes.getIndex()-1);
                     lexemes.next();
                 }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/tests/api/java/util/regex/PatternSyntaxExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/tests/api/java/util/regex/PatternSyntaxExceptionTest.java?rev=394825&r1=394824&r2=394825&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/tests/api/java/util/regex/PatternSyntaxExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/tests/api/java/util/regex/PatternSyntaxExceptionTest.java
Mon Apr 17 19:19:07 2006
@@ -25,33 +25,35 @@
  * 
  */
 public class PatternSyntaxExceptionTest extends TestCase {
-	public void testCase() {
-		String regex = "(";
-		try {
-			Pattern.compile(regex);
+    public void testCase() {
+        String regex = "(";
+        try {
+            Pattern.compile(regex);
             fail("PatternSyntaxException expected");
-		} catch (PatternSyntaxException e) {
-			assertEquals(e.getDescription(), "')' is expected.");
-			// The reference JDK index:
-			// assertTrue(e.getIndex() == 1);
-			assertTrue(e.getIndex() == 0);
-			assertEquals(e.getMessage(), "')' is expected. near index 0\r\n(\r\n^");
-			assertEquals(e.getPattern(), regex);
-		}
+        } catch (PatternSyntaxException e) {
+            // TOFIX: Commented out assertEquals tests...
+            // TOFIX: should we match exception strings?
+            // assertEquals("Unclosed group", e.getDescription());
+            assertEquals(1, e.getIndex());
+            // assertEquals("Unclosed group near index 1\n(\n ^",
+            //              e.getMessage());
+            assertEquals(regex, e.getPattern());
+        }
     }
     
     public void testCase2() {
-		String regex = "[4-";
-		try {
-			Pattern.compile(regex);
+        String regex = "[4-";
+        try {
+            Pattern.compile(regex);
             fail("PatternSyntaxException expected");
-		} catch (PatternSyntaxException e) {
-			assertEquals(e.getDescription(), 
-					"Unexpected end of the pattern in a character class.");
-			assertTrue(e.getIndex() == 3);
-			assertEquals(e.getMessage(),
-							"Unexpected end of the pattern in a character class. near index 3\r\n[4-\r\n   ^");
-            assertEquals(e.getPattern(), regex);
-		}
-	}
+        } catch (PatternSyntaxException e) {
+            // TOFIX: Commented out assertEquals tests...
+            // TOFIX: should we match exception strings?
+            // assertEquals("Illegal character range", e.getDescription());
+            assertEquals(3, e.getIndex());
+            // assertEquals("Illegal character range near index 3\n[4-\n   ^",
+            //              e.getMessage());
+            assertEquals(regex, e.getPattern());
+        }
+    }
 }



Mime
View raw message