From: <bi...@us...> - 2010-04-25 18:08:41
|
Revision: 5821 http://oorexx.svn.sourceforge.net/oorexx/?rev=5821&view=rev Author: bigrixx Date: 2010-04-25 18:08:34 +0000 (Sun, 25 Apr 2010) Log Message: ----------- Fix bug in matches method and a few more tests Modified Paths: -------------- incubator/regex/regex.cls incubator/regex/regex.testGroup Modified: incubator/regex/regex.cls =================================================================== --- incubator/regex/regex.cls 2010-04-25 17:45:20 UTC (rev 5820) +++ incubator/regex/regex.cls 2010-04-25 18:08:34 UTC (rev 5821) @@ -2681,6 +2681,12 @@ -- set the end match position context~matchEnd = position + -- if we require a match with the end, then only return true + -- if our position is at the end + if context~matchEndRequired then do + return position == context~endPosition + end + -- this is always a successful match. This really just -- records the last position of this branch segment. return .true Modified: incubator/regex/regex.testGroup =================================================================== --- incubator/regex/regex.testGroup 2010-04-25 17:45:20 UTC (rev 5820) +++ incubator/regex/regex.testGroup 2010-04-25 18:08:34 UTC (rev 5821) @@ -64,9 +64,12 @@ -- now some matching/search tests self~assertTrue(p~matches("foo")) - self~assertTrue(p~matches("foobar")) + self~assertFalse(p~matches("foobar")) + self~assertFalse(p~matches("fo")) + self~assertFalse(p~matches(" foo")) self~assertTrue(p~startsWith("foo")) self~assertTrue(p~startsWith("fooBar")) + self~assertFalse(p~startsWith(" foo")) r = p~find("foo") self~assertTrue(r~matched) @@ -77,7 +80,6 @@ self~assertEquals("", r~prefix) self~assertEquals("", r~suffix) - r = p~find("xxxfooyyy") self~assertTrue(r~matched) self~assertEquals(4, r~start) @@ -87,4 +89,13 @@ self~assertEquals("xxx", r~prefix) self~assertEquals("yyy", r~suffix) + r = p~find("xyzzy") + self~assertFalse(r~matched) + self~assertEquals(0, r~start) + self~assertEquals(0, r~end) + self~assertEquals(0, r~length) + self~assertEquals("", r~text) + self~assertEquals("", r~prefix) + self~assertEquals("xyzzy", r~suffix) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |