Community
Participate
Working Groups
Use eunit framework. All variations should pass library tester s1 string; pattern string; escapeStr string; actual boolean; expected boolean; // isLike with escape no match function runIsLikeFunction07(){@Test} s1 = "ab%defd"; pattern = "ab\\%def"; actual = s1.isLike(pattern); expected = false; LogResult.assertTrue1( (actual == expected) ); end // isLike with escapeStr no match function runIsLikeFunction08(){@Test} s1 = "ab%defd"; pattern = "ab+%def"; escapeStr = "+"; actual = s1.isLike(pattern, escapeStr); expected = false; LogResult.assertTrue1( (actual == expected) ); end // isLike with leading spaces function runIsLikeFunction09(){@Test} s1 = " hello"; pattern = " hello"; actual = s1.isLike(pattern); expected = false; LogResult.assertTrue1((actual == expected) ); end // isLike with empty parameter function runIsLikeFunction11(){@Test} s1 = "ab*def"; pattern = ""; actual = s1.isLike(pattern); expected = false; LogResult.assertTrue1( (actual == expected) ); end end
Matt, Can you comment on this? I noticed that the old RT used to trim the pattern, rather than clip it, so I fixed that and now I get the expected results for the 2nd and 3rd tests; however, the first and last tests still fail but for a different reason. Neither the old JS RT nor the new Java RT seem to assume an implied end-of-string on the pattern, so in both of these tests, the result is "true" because the resulting regexp patterns are a subset of the strings being considered. So, we need a ruling on this (preferably resulting in more details in the comments for this function in EString.egl).
Scott, please ask Brian. I can't work on EDT anymore. Have to be on RBD full-time for a while.
Brian, Since Matt is unavailable, can you make the language ruling required for me to finish fixing this, or name someone who can?
matches might have similar issue function runMatchesPatternFunction08(){@Test} s1 string = " ab*def"; pattern string = "ab\\*[abcd][abcde][^a-e]"; actual string = s1.matchesPattern(pattern); expected boolean = false; LogResult.assertTrue("matchesPattern with complex pattern and leading spaces", (actual == expected) ); end function runMatchesPatternFunction11(){@Test} s1 string = "ab*def"; pattern string = ""; actual string = s1.matchesPattern(pattern); expected boolean= false; LogResult.assertTrue("matchesPattern with empty parameter", (actual == expected) ); end
Hi Kathy, I'm not sure if the following variation is correct 1. function runIsLikeFunction08(){@Test} s1 = "ab%defd"; pattern = "ab+%def"; escapeStr = "+"; Since "+" is escape character, then the pattern is identical to "ab%def", why the result is false? 2.function runIsLikeFunction11(){@Test} and function runMatchesPatternFunction11(){@Test} pattern = ""; I think any string should match empty string. What do you think?
The first string ends with an extra d which makes the pattern match fail. s1 = "ab%defd"; Second question, the string includes the pattern but isn't the pattern.
Created attachment 207274 [details] Fix
EUnit EString007 all passed
Verified with 20111127_2101 and closed