harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r416302 - in /incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex: MatcherTest.java PatternTest.java
Date Thu, 22 Jun 2006 09:04:22 GMT
Author: tellison
Date: Thu Jun 22 02:04:21 2006
New Revision: 416302

URL: http://svn.apache.org/viewvc?rev=416302&view=rev
Log:
Apply additional tests patch for HARMONY-610 (java.util.regex.Matcher.matches() fails when
the default region is changed)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java?rev=416302&r1=416301&r2=416302&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
Thu Jun 22 02:04:21 2006
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *  Copyright 2005, 2006 The Apache Software Foundation or its licensors, as applicable.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -603,6 +603,35 @@
 		assertTrue(mat.find());
 		assertEquals("a", mat.group());
 	}
+
+    /*
+     * Verify if the Matcher can match the input when region is changed
+     */
+    public void testMatchesRegionChanged() {
+        // Regression for HARMONY-610
+        String input = " word ";
+        Pattern pattern = Pattern.compile("\\w+");
+        Matcher matcher = pattern.matcher(input);
+        matcher.region(1, 5);
+        assertTrue(matcher.matches());
+    }
+
+    /*
+     * Verify if the Matcher behaves correct when region is changed
+     */
+    public void testFindRegionChanged() {
+        // Regression for HARMONY-625
+        Pattern pattern = Pattern.compile("(?s).*");
+        Matcher matcher = pattern.matcher("abcde");
+        matcher.find();
+        assertEquals("abcde", matcher.group());
+        
+        matcher = pattern.matcher("abcde");
+        matcher.region(0, 2);
+        matcher.find();
+        assertEquals("ab", matcher.group());
+
+    }
 
     public static void main(String[] args) {
         junit.textui.TestRunner.run(MatcherTest.class);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java?rev=416302&r1=416301&r2=416302&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
Thu Jun 22 02:04:21 2006
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *  Copyright 2005, 2006 The Apache Software Foundation or its licensors, as applicable.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -1022,7 +1022,25 @@
     	assertTrue(mat.matches());
     }
 
-   
+    /*
+     * Verify if the Pattern support the following character classes:
+     * \p{javaLowerCase} \p{javaUpperCase} \p{javaWhitespace} \p{javaMirrored}
+     */
+    public void testCompileCharacterClass() {
+        // Regression for HARMONY-606
+        Pattern pattern = Pattern.compile("\\p{javaLowerCase}");
+        assertNotNull(pattern);
+        
+        pattern = Pattern.compile("\\p{javaUpperCase}");
+        assertNotNull(pattern);
+        
+        pattern = Pattern.compile("\\p{javaWhitespace}");
+        assertNotNull(pattern);
+        
+        pattern = Pattern.compile("\\p{javaMirrored}");
+        assertNotNull(pattern);
+    }
+
     public static void main(String[] args) {
         junit.textui.TestRunner.run(PatternTest.class);
     }



Mime
View raw message