Manual diff again ...<br>
<br>
Best,<br>
Christoph<br>
<br>
<b>==================== Summary ====================</b><br>
<br>
Name: Regex-Tests-Core-ct.30<br>
Author: ct<br>
Time: 5 October 2022, 8:04:59.150966 pm<br>
UUID: 39d75aee-88a4-a647-9485-84d2ac56cb99<br>
Ancestors: Regex-Tests-Core-mt.17, Regex-Tests-Core-ct.15, Regex-Tests-Core-ct.17, Regex-Tests-Core-ct.18, Regex-Tests-Core-ct.19, Regex-Tests-Core-ct.20, Regex-Tests-Core-ct.21, Regex-Tests-Core-ct.22, Regex-Tests-Core-ct.23, Regex-Tests-Core-ct.26, Regex-Tests-Core-ct.25, Regex-Tests-Core-ct.27, Regex-Tests-Core-ct.28, Regex-Tests-Core-tobe.17<br>
<br>
Merge commit.<br>
<br>
Regex-Tests-Core-ct.15:<br>
Tests #escapeRegex from Regex-Core-ct.61.<br>
<br>
Revision: Rename to #escapeForRegex (complements Regex-Core-ct.78).<br>
<br>
Regex-Tests-Core-ct.17:<br>
Adds a regression test for parsing regular expressions with nested quantifiers. Thanks to Conrad Halle for reporting this bug!<br>
<br>
Regex-Tests-Core-ct.18:<br>
Adds regression test for a bug while parsing lookaround-like regexes.<br>
<br>
Regex-Tests-Core-ct.19:<br>
Tests non-capturing groups. Complements Regex-Core-ct.63.<br>
<br>
Regex-Tests-Core-ct.20:<br>
Adds regression test for captured lookaround expressions.<br>
<br>
Regex-Tests-Core-ct.21:<br>
Adds regression tests for quantifier sequences.<br>
<br>
Revision: Extends tests with all possible minimal/possessive quantifiers and explanation.<br>
<br>
Regex-Tests-Core-ct.22:<br>
Complements Regex-Core-ct.66 (convenience selectors).<br>
<br>
Regex-Tests-Core-ct.23:<br>
Complements Regex-Core-ct.67 (named capturing groups).<br>
<br>
Revision: Add updated tests for #keyedSubexpressionRanges: and #subexpressionRanges:.<br>
<br>
Regex-Tests-Core-ct.25:<br>
Fixes #testOptionalLookbehind2. It still fails, but this time for the real bug in the matcher instead of a lowercase slip in the test.<br>
<br>
Revision for Regex-Core-ct.70 from Regex-Core-ct.78: Fixes #testOptionalLookbehind2 really, resolves the expected failure, and merges it back into #testOptionalLookbehind. Adds #testMatchNullable.<br>
<br>
Regex-Tests-Core-ct.26:<br>
Tests nullable closures that are introduced in Regex-Core-ct.70.<br>
<br>
Revision: Don't deny nullable lookarounds any longer in #testLookaroundParser.<br>
<br>
Regex-Tests-Core-ct.27:<br>
Merges two tests that are no-longer to do.<br>
<br>
Regex-Tests-Core-ct.28:<br>
Complements Regex-Core-ct.71 (Unicode backslash atoms). ... Merges Regex-Tests-Core-tobe.17.<br>
<br>
Revision: Add test for non-existing Unicode category.<br>
<br>
Regex-Tests-Core-ct.30:<br>
Complements Regex-Core-ct.66 (convenience selectors).<br>
<br>
Revision: Adds regression fixture on order of capture groups within branches (complements revision in Regex-Core-ct.78).<br>
<br>
<b>=============== Diff against Regex-Tests-Core-mt.17 ===============</b><br>
<br>
<b>RxMatcherTest>>runMatcher:with:expect:withSubexpressions: {utilties} · ct 10/20/2021 20:24 (changed)</b><br>
runMatcher: aMatcher with: aString expect: aBoolean withSubexpressions: anArray<br>
| copy got |<br>
copy := aMatcher<br>
copy: aString<br>
translatingMatchesUsing: [ :each | each ].<br>
self <br>
assert: copy = aString<br>
description: 'Copying: expected ' , aString printString , ', but got ' , copy printString.<br>
got := aMatcher search: aString.<br>
self<br>
assert: got = aBoolean <br>
description: 'Searching: expected ' , aBoolean printString , ', but got ' , got printString.<br>
(anArray isNil or: [ aMatcher supportsSubexpressions not ])<br>
ifTrue: [ ^ self ].<br>
1 to: anArray size by: 2 do: [ :index |<br>
| sub subExpect subGot |<br>
sub := anArray at: index.<br>
subExpect := anArray at: index + 1.<br>
<s><font color="#0000FF">- subGot := aMatcher subexpression: sub.<br>
</font></s><font color="#FF0000">+ subGot := (subExpect isNil or: [subExpect isString])<br>
+ ifTrue: [aMatcher subexpression: sub]<br>
+ ifFalse: [aMatcher subexpressions: sub].<br>
</font> self<br>
assert: subExpect = subGot<br>
description: 'Subexpression ' , sub printString , ': expected ' , subExpect printString , ', but got ' , subGot printString ]<br>
<br>
<b>RxMatcherTest>>testCapturingGroup {testing} · ct 8/23/2021 18:02</b><br>
<font color="#FF0000">+ testCapturingGroup<br>
+ <br>
+ self runRegex: #('(a)(b)c'<br>
+ 'c' false nil<br>
+ 'abc' true (1 'abc' 2 'a' 3 'b')<br>
+ 'eabcd' true (1 'abc' 2 'a' 3 'b')).<br>
+ self flag: #tests. "ct: It might be helpful to test subexpressionCount, too"</font><br>
<br>
<b>RxMatcherTest>>testHenry039 {testing-henry} · ct 10/28/2021 02:44 (changed)</b><br>
testHenry039<br>
<s><font color="#0000FF">- self runRegex: #('a[a-b-c]' nil)<br>
</font></s><font color="#FF0000">+ self runRegex: #('a[a-c-d]'<br>
+ 'aa' true nil<br>
+ 'ab' true nil<br>
+ 'ac' true nil<br>
+ 'ad' true nil<br>
+ 'a-' true nil<br>
+ 'ae' false nil)</font><br>
<br>
<b>RxMatcherTest>>testHenry071 {testing-henry} · ct 10/21/2021 00:00 (changed)</b><br>
testHenry071<br>
<s><font color="#0000FF">- self runRegex: #('()*' nil)<br>
</font></s><font color="#FF0000">+ self runRegex: #('^()*$' '' true (1 '' 2 ('')))</font><br>
<br>
<b>RxMatcherTest>>testHenry073 {testing-henry} · ct 10/21/2021 00:27 (changed)</b><br>
testHenry073<br>
<s><font color="#0000FF">- self runRegex: #('^*' nil)<br>
</font></s><font color="#FF0000">+ self runRegex: #('^*' '' true nil)</font><br>
<br>
<b>RxMatcherTest>>testHenry074 {testing-henry} · ct 10/21/2021 00:28 (changed)</b><br>
testHenry074<br>
<s><font color="#0000FF">- self runRegex: #('$*' nil)<br>
</font></s><font color="#FF0000">+ self runRegex: #('$*' '' true nil)</font><br>
<br>
<b>RxMatcherTest>>testHenry088 {testing-henry} · ct 10/21/2021 00:01 (changed)</b><br>
testHenry088<br>
<s><font color="#0000FF">- self runRegex: #('(a*)*' nil)<br>
</font></s><font color="#FF0000">+ self runRegex: #('^(a*)*a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 (''))<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa')))</font><br>
<br>
<b>RxMatcherTest>>testHenry089 {testing-henry} · ct 10/21/2021 00:01 (changed)</b><br>
testHenry089<br>
<s><font color="#0000FF">- self runRegex: #('(a*)+' nil)<br>
</font></s><font color="#FF0000">+ self runRegex: #('^(a*)+a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 (''))<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa')))</font><br>
<br>
<b>RxMatcherTest>>testHenry090 {testing-henry} · ct 10/20/2021 21:47 (changed)</b><br>
testHenry090<br>
<s><font color="#0000FF">- self runRegex: #('(a|)*' nil)<br>
</font></s><font color="#FF0000">+ self runRegex: #('(a|)*'<br>
+ '' true (1 '')<br>
+ 'a' true (1 'a' 2 ('a'))<br>
+ 'aa' true (1 'aa' 2 ('a' 'a')))</font><br>
<br>
<b>RxMatcherTest>>testHenry091 {testing-henry} · ct 10/20/2021 21:53 (changed)</b><br>
testHenry091<br>
<s><font color="#0000FF">- self runRegex: #('(a*|b)*' nil)<br>
</font></s><font color="#FF0000">+ self runRegex: #('(a*|b)*$'<br>
+ '' true (1 '')<br>
+ 'a' true (1 'a' 2 ('a'))<br>
+ 'aa' true (1 'aa' 2 ('aa'))<br>
+ 'bb' true (1 'bb' 2 ('b' 'b'))<br>
+ 'aabba' true (1 'aabba' 2 ('aa' 'b' 'b' 'a')))</font><br>
<br>
<b>RxMatcherTest>>testHenry096 {testing-henry} · ct 10/20/2021 20:32 (changed)</b><br>
testHenry096<br>
<s><font color="#0000FF">- self runRegex: #('(^)*' nil)<br>
</font></s><font color="#FF0000">+ self runRegex: #('(^)*'<br>
+ '' true (1 '' 2 '')<br>
+ 'a' true (1 '' 2 ''))</font><br>
<br>
<b>RxMatcherTest>>testHenry097 {testing-henry} · ct 10/20/2021 21:53 (changed)</b><br>
testHenry097<br>
<s><font color="#0000FF">- self runRegex: #('(ab|)*' nil)<br>
</font></s><font color="#FF0000">+ self runRegex: #('(ab|)*'<br>
+ '' true (1 '' 2 '')<br>
+ 'ab' true (1 'ab' 2 ('ab'))<br>
+ 'abab' true (1 'abab' 2 ('ab' 'ab')))</font><br>
<br>
<b>RxMatcherTest>>testHenry138 {testing-henry} · ct 10/20/2021 23:21</b><br>
<font color="#FF0000">+ testHenry138<br>
+ self runRegex: #('(a|b?)?'<br>
+ '' true (1 '' 2 (''))<br>
+ 'a' true (1 'a' 2 ('a'))<br>
+ 'b' true (1 'b' 2 ('b'))<br>
+ 'ab' false)</font><br>
<br>
<b>RxMatcherTest>>testHenry141 {testing-henry} · ct 10/20/2021 23:37</b><br>
<font color="#FF0000">+ testHenry141<br>
+ self runRegex: #('^(a*)?a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 (''))<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa')))</font><br>
<br>
<b>RxMatcherTest>>testHenry142 {testing-henry} · ct 10/20/2021 23:37</b><br>
<font color="#FF0000">+ testHenry142<br>
+ self runRegex: #('^(a*){1,2}a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 ('' ''))<br>
+ 'aa' true (1 'aa' 2 ('a' ''))<br>
+ 'aaa' true (1 'aaa' 2 ('aa' '')))</font><br>
<br>
<b>RxMatcherTest>>testHenry143 {testing-henry} · ct 10/20/2021 23:37</b><br>
<font color="#FF0000">+ testHenry143<br>
+ self runRegex: #('^(a+)*a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 ())<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa')))</font><br>
<br>
<b>RxMatcherTest>>testHenry144 {testing-henry} · ct 10/20/2021 23:37</b><br>
<font color="#FF0000">+ testHenry144<br>
+ self runRegex: #('^(a+)+a$'<br>
+ '' false nil<br>
+ 'a' false nil<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa')))</font><br>
<br>
<b>RxMatcherTest>>testHenry145 {testing-henry} · ct 10/20/2021 23:37</b><br>
<font color="#FF0000">+ testHenry145<br>
+ self runRegex: #('^(a+)?a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 ())<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa')))</font><br>
<br>
<b>RxMatcherTest>>testHenry146 {testing-henry} · ct 10/20/2021 23:37</b><br>
<font color="#FF0000">+ testHenry146<br>
+ self runRegex: #('^(a+){1,2}a$'<br>
+ '' false nil<br>
+ 'a' false nil<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa')))</font><br>
<br>
<b>RxMatcherTest>>testHenry147 {testing-henry} · ct 10/20/2021 23:37</b><br>
<font color="#FF0000">+ testHenry147<br>
+ self runRegex: #('^(a?)*a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 (''))<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('a' 'a')))</font><br>
<br>
<b>RxMatcherTest>>testHenry148 {testing-henry} · ct 10/20/2021 23:37</b><br>
<font color="#FF0000">+ testHenry148<br>
+ self runRegex: #('^(a?)+a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 (''))<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('a' 'a')))</font><br>
<br>
<b>RxMatcherTest>>testHenry149 {testing-henry} · ct 10/20/2021 23:36</b><br>
<font color="#FF0000">+ testHenry149<br>
+ self runRegex: #('^(a?)?a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 (''))<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' false nil)</font><br>
<br>
<b>RxMatcherTest>>testHenry150 {testing-henry} · ct 10/20/2021 23:38</b><br>
<font color="#FF0000">+ testHenry150<br>
+ self runRegex: #('^(a?){1,2}a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 ('' ''))<br>
+ 'aa' true (1 'aa' 2 ('a' ''))<br>
+ 'aaa' true (1 'aaa' 2 ('a' 'a')))</font><br>
<br>
<b>RxMatcherTest>>testHenry151 {testing-henry} · ct 10/20/2021 23:41</b><br>
<font color="#FF0000">+ testHenry151<br>
+ self runRegex: #('^(a{1,2})*a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 ())<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa'))<br>
+ 'aaaa' true (1 'aaaa' 2 ('aa' 'a')))</font><br>
<br>
<b>RxMatcherTest>>testHenry152 {testing-henry} · ct 10/20/2021 23:41</b><br>
<font color="#FF0000">+ testHenry152<br>
+ self runRegex: #('^(a{1,2})+a$'<br>
+ '' false nil<br>
+ 'a' false nil<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa'))<br>
+ 'aaaa' true (1 'aaaa' 2 ('aa' 'a')))</font><br>
<br>
<b>RxMatcherTest>>testHenry153 {testing-henry} · ct 10/20/2021 23:42</b><br>
<font color="#FF0000">+ testHenry153<br>
+ self runRegex: #('^(a{1,2})?a$'<br>
+ '' false nil<br>
+ 'a' true (1 'a' 2 nil)<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa'))<br>
+ 'aaaa' false nil)</font><br>
<br>
<b>RxMatcherTest>>testHenry154 {testing-henry} · ct 10/20/2021 23:40</b><br>
<font color="#FF0000">+ testHenry154<br>
+ self runRegex: #('^(a{1,2}){1,2}a$'<br>
+ '' false nil<br>
+ 'a' false nil<br>
+ 'aa' true (1 'aa' 2 ('a'))<br>
+ 'aaa' true (1 'aaa' 2 ('aa'))<br>
+ 'aaaa' true (1 'aaaa' 2 ('aa' 'a')))</font><br>
<br>
<b>RxMatcherTest>>testKeyedSubexpressions {testing-protocol} · ct 10/5/2022 13:02</b><br>
<font color="#FF0000">+ testKeyedSubexpressions<br>
+ <br>
+ {<br>
+ #('abc' () ()).<br>
+ #('(\w)+' () ()).<br>
+ {'(?<foo>a)b(c)'. #(foo ('a')). {#foo. {1 to: 1}}}.<br>
+ {'(?<foo>\w+)'. #(foo ('abc')). {#foo. {1 to: 3}}}.<br>
+ {'(?<foo>\w)+'. #(foo ('a' 'b' 'c')). {#foo. {1 to: 1. 2 to: 2. 3 to: 3}}}.<br>
+ #('abc(?<foo>\w)?' (foo ()) (foo ()))<br>
+ } do: [:spec |<br>
+ | matcher |<br>
+ matcher := spec first asRegex.<br>
+ self assert: (matcher matches: 'abc').<br>
+ self<br>
+ assert: (Dictionary newFromPairs: spec second)<br>
+ equals: matcher allKeyedSubexpressions.<br>
+ self<br>
+ assert: (Dictionary newFromPairs: spec third) associations<br>
+ equals:<br>
+ (matcher keyedMarkers collect:<br>
+ [:key | key -> (matcher keyedSubexpressionRanges: key) asArray])].</font><br>
<br>
<b>RxMatcherTest>>testMatchNullable {testing} · ct 10/5/2022 14:48</b><br>
<font color="#FF0000">+ testMatchNullable<br>
+ <br>
+ self assert: #('A' '' '') equals: ('AB' allRegexMatches: 'A?') asArray.</font><br>
<br>
<b>RxMatcherTest>>testNonCapturingGroup {testing} · ct 8/23/2021 18:02</b><br>
<font color="#FF0000">+ testNonCapturingGroup<br>
+ <br>
+ self runRegex: #('(?:a)(b)c'<br>
+ 'bc' false nil<br>
+ 'abc' true (1 'abc' 2 'b')<br>
+ 'eabcd' true (1 'abc' 2 'b')).<br>
+ self flag: #tests. "ct: It might be helpful to test subexpressionCount, too"</font><br>
<br>
<b>RxMatcherTest>>testSubexpressions {testing-protocol} · ct 10/5/2022 12:53</b><br>
<font color="#FF0000">+ testSubexpressions<br>
+ <br>
+ {<br>
+ {'abc'. #(('abc')). {{1 to: 3}}}.<br>
+ {'(a)b(c)'. #(('abc') ('a') ('c')). {{1 to: 3}. {1 to: 1}. {3 to: 3}}}. <br>
+ {'(\w+)'. #(('abc') ('abc')). {{1 to: 3}. {1 to: 3}}}.<br>
+ {'(\w)+'. #(('abc') ('a' 'b' 'c')). {{1 to: 3}. {1 to: 1. 2 to: 2. 3 to: 3}}}.<br>
+ {'abc(\w)?'. #(('abc') ()). {{1 to: 3}. {}}}.<br>
+ {'((a)|(b))((a)|(b))c'. #(('abc') ('a') ('a') () ('b') () ('b')). {{1 to: 3}. {1 to: 1}. {1 to: 1}. {}. {2 to: 2}. {}. {2 to: 2}}}<br>
+ } do: [:spec |<br>
+ | matcher |<br>
+ matcher := spec first asRegex.<br>
+ self assert: (matcher matches: 'abc').<br>
+ self<br>
+ assert: spec second<br>
+ equals: (matcher allSubexpressions collect: #asArray).<br>
+ self<br>
+ assert: spec third<br>
+ equals:<br>
+ ((1 to: matcher subexpressionCount) collect:<br>
+ [:index | (matcher subexpressionRanges: index) asArray])].</font><br>
<br>
<b>RxParserTest>>expectedFailures {failures} · mt 6/8/2022 15:03 (removed)</b><br>
<s><font color="#0000FF">- expectedFailures<br>
- <br>
- ^ #(testOptionalLookbehind2)</font></s><br>
<br>
<b>RxParserTest>>testCharacterSetWithEscapedCharacters {tests} · ct 10/27/2021 23:17 (changed)</b><br>
testCharacterSetWithEscapedCharacters<br>
"self debug: #testCharacterSetRange"<br>
<br>
{<br>
'[\r]'. String cr. String space.<br>
'[\n]'. String lf. String space.<br>
'[\t]'. String tab. String space.<br>
'[\e]'. Character escape asString. String space.<br>
'[\f]'. Character newPage asString. String space.<br>
'[\]]+'. ']]]'. '[[['.<br>
'[\S]+[\s]+=[\s]+#[^\[(]'. 'foo = #bar'. 'foo = #[1 2 3]'.<br>
'[\d]+'. '123'. 'abc'.<br>
'[\D]+'. 'abc'. '123'.<br>
'[\w]+'. 'a1_b2'. '...'.<br>
'[\W]+'. '...'. 'a1_b2'.<br>
<font color="#FF0000">+ '[\b]'. 'b'. ' '.<br>
+ '[\p{L}\d]+'. 'tschüß123'. ':-)'.<br>
+ '[\P{L}a]'. 'a'. 'b'.<br>
</font> } groupsDo: [ :regexString :inputToAccept :inputToReject |<br>
| regex |<br>
regex := regexString asRegex.<br>
self<br>
assert: (regex search: inputToAccept);<br>
deny: (regex search: inputToReject) ]<br>
<br>
<b>RxParserTest>>testCodePointu {tests} · ct 10/28/2021 04:46</b><br>
<font color="#FF0000">+ testCodePointu<br>
+ <br>
+ | string |<br>
+ string := String value: 16r1f388.<br>
+ self assert: [string matchesRegex: '\u{1f388}'].<br>
+ self assert: ['A' matchesRegex: '\u0041'].<br>
+ self assert: ['Aa' matchesRegex: '\u0041a'].<br>
+ self assert: ['m' matchesRegex: '\u006D'].<br>
+ self assert: ['m' matchesRegex: '\u006d'].<br>
+ self should: ['\u004' asRegex] raise: RegexSyntaxError.<br>
+ self should: ['\u0g41' asRegex] raise: RegexSyntaxError.<br>
+ <br>
+ self assert: ['e' matchesRegex: '\u{ar101}'].<br>
+ self deny: [string matchesRegex: '\u{1f387}'].<br>
+ self deny: ['\u{1f388}' matchesRegex: '\u{1f388}'].<br>
+ self deny: ['1f388' matchesRegex: '\u{1f388}'].<br>
+ self deny: ['u' matchesRegex: '\u{1}'].<br>
+ self deny: [(String value: 16r1f389) matchesRegex: '\u{1f388}'].<br>
+ self deny: [(WideString fromByteArray: #(16r17f3 16r88)) matchesRegex: '\u{1f388}'].<br>
+ self deny: [(WideString fromByteArray: #(16r17f3 88)) matchesRegex: '\u{1f388}'].<br>
+ <br>
+ self assert: ['m' matchesRegex: '[\u006d]'].<br>
+ self assert: ['3' matchesRegex: '[\u0032-4]'].<br>
+ self deny: ['0' matchesRegex: '[\u0032-4]'].<br>
+ self assert: ['3' matchesRegex: '[2-\u0034]'].<br>
+ self deny: ['0' matchesRegex: '[2-\u0034]'].<br>
+ self should: ['[\u006d-\d]' asRegex] raise: RegexSyntaxError.<br>
+ self should: ['[\d-\u006d]' asRegex] raise: RegexSyntaxError.<br>
+ self assert: ['A' matchesRegex: '[\u006d-\u006fA]'].</font><br>
<br>
<b>RxParserTest>>testCodePointx {tests} · ct 10/28/2021 04:47</b><br>
<font color="#FF0000">+ testCodePointx<br>
+ <br>
+ self assert: ['8' matchesRegex: '\x38'].<br>
+ self deny: ['8' matchesRegex: '\x39'].<br>
+ self deny: ['9' matchesRegex: '\x38'].<br>
+ self deny: ['&' matchesRegex: '\x38'].<br>
+ self deny: ['\x38' matchesRegex: '\x38'].<br>
+ self deny: ['38' matchesRegex: '\x38'].<br>
+ self assert: ['8a' matchesRegex: '\x38a'].<br>
+ self should: ['\x3' asRegex] raise: RegexSyntaxError.<br>
+ self deny: [(WideString fromByteArray: {3. 8}) matchesRegex: '\x38'].<br>
+ self deny: [(WideString fromByteArray: {3. 38}) matchesRegex: '\x38'].<br>
+ self deny: [(String new: 20 withAll: $x) matchesRegex: '\x20'].<br>
+ <br>
+ self assert: ['8' matchesRegex: '\x{38}'].<br>
+ self assert: ['?' matchesRegex: '\x{38a}'].<br>
+ self assert: ['8' matchesRegex: '\x{2r111000}'].<br>
+ self deny: ['8' matchesRegex: '\x{39}'].<br>
+ self deny: ['9' matchesRegex: '\x{38}'].<br>
+ self deny: ['\x{38}' matchesRegex: '\x{38}'].<br>
+ <br>
+ self assert: ['8a' matchesRegex: '[\x38a]+'].</font><br>
<br>
<b>RxParserTest>>testEscapeString {tests} · ct 10/5/2022 11:18</b><br>
<font color="#FF0000">+ testEscapeString<br>
+ <br>
+ | string |<br>
+ string := 'Hello world, how are you? (This is a test - special characters *very much* intended \-.-/ )'.<br>
+ self assert: (string matchesRegex: string escapeForRegex).<br>
+ self assert: (string includesSubstring: 'Hello world, how are you?') "no all-out escaping".</font><br>
<br>
<b>RxParserTest>>testLookaroundNullable {tests} · ct 10/21/2021 00:04 (changed)</b><br>
testLookaroundNullable<br>
<br>
<s><font color="#0000FF">- self should: ['(?<=a)?b' asRegex] raise: RegexSyntaxError.<br>
</font></s><font color="#FF0000">+ self assert: ('b' matchesRegex: '(?<=a)?b').<br>
+ self assert: ('(?<=a)?b' asRegex search: 'ab').</font><br>
<br>
<b>RxParserTest>>testLookaroundParser {tests} · ct 10/5/2022 13:42</b><br>
<font color="#FF0000">+ testLookaroundParser<br>
+ <br>
+ self should: ['(?<a)b' asRegex] raise: RegexSyntaxError.</font><br>
<br>
<b>RxParserTest>>testNestedQuantifiers {tests} · ct 8/23/2021 17:23</b><br>
<font color="#FF0000">+ testNestedQuantifiers<br>
+ <br>
+ self deny: ('' matchesRegex: '(ab+){2,}').<br>
+ self deny: ('ab' matchesRegex: '(ab+){2,}').<br>
+ self deny: ('aba' matchesRegex: '(ab+){2,}').<br>
+ self assert: ('abab' matchesRegex: '(ab+){2,}').<br>
+ self assert: ('abbabbb' matchesRegex: '(ab+){2,}').<br>
+ self assert: ('abbabbbab' matchesRegex: '(ab+){2,}').</font><br>
<br>
<b>RxParserTest>>testNoCapturingOfLookarounds {tests} · ct 8/23/2021 18:43</b><br>
<font color="#FF0000">+ testNoCapturingOfLookarounds<br>
+ <br>
+ | matcher |<br>
+ matcher := '(?<=a)(?<!c)(b)(?=c)(?!b)' asRegex.<br>
+ self assert: (matcher search: 'abc').<br>
+ self assert: 2 equals: matcher subexpressionCount.<br>
+ self assert: #('b') equals: (matcher subexpressions: 2)</font><br>
<br>
<b>RxParserTest>>testOptionalLookbehind {tests} · ct 10/5/2022 14:51 (changed)</b><br>
testOptionalLookbehind<br>
<br>
<s><font color="#0000FF">- self assert: ['A' matchesRegex: '((?<=^)A)+'].<br>
</font></s><font color="#FF0000">+ self assert: ['A' matchesRegex: '((?<=^)A)+'].<br>
+ self assert: [('AB' allRegexMatches: '((?<=A)B)?') asArray = #('' 'B' '')].</font><br>
<br>
<b>RxParserTest>>testOptionalLookbehind2 {tests} · mt 7/8/2021 08:22 (removed)</b><br>
<s><font color="#0000FF">- testOptionalLookbehind2<br>
- <br>
- self assert: [('AB' allRegexMatches: '((?<=a)b)?') asArray = #('A')].</font></s><br>
<br>
<b>RxParserTest>>testOrOperator {tests} · ct 10/20/2021 16:40 (changed)</b><br>
testOrOperator<br>
"self debug: #testOrOperator"<br>
<br>
"The last operator is `|' meaning `or'. It is placed between two<br>
regular expressions, and the resulting expression matches if one of<br>
the expressions matches. It has the lowest possible precedence (lower<br>
than sequencing). For example, `ab*|ba*' means `a followed by any<br>
number of b's, or b followed by any number of a's':"<br>
<br>
self assert: ('abb' matchesRegex: 'ab*|ba*'). <br>
self assert: ('baa' matchesRegex: 'ab*|ba*'). <br>
self deny: ('baab' matchesRegex: 'ab*|ba*').<br>
<br>
<s><font color="#0000FF">- <br>
- "It is possible to write an expression matching an empty string, for<br>
- example: `a|'. However, it is an error to apply `*', `+', or `?' to<br>
- such expression: `(a|)*' is an invalid expression."<br>
- <br>
- self should: ['(a|)*' asRegex] raise: Error.<br>
</font></s><font color="#FF0000">+ <br>
+ self assert: ('' matchesRegex: '(a|)*').<br>
+ self assert: ('a' matchesRegex: '(a|)*').<br>
+ self assert: ('aa' matchesRegex: '(a|)*').<br>
</font><br>
<br>
<b>RxParserTest>>testQuantifierSequence {tests} · ct 10/5/2022 11:48</b><br>
<font color="#FF0000">+ testQuantifierSequence<br>
+ <br>
+ "Unless we add support for minimal quantifiers, the following should raise a syntax error."<br>
+ self<br>
+ should: ['a??' asRegex] raise: RegexSyntaxError;<br>
+ should: ['+?' asRegex] raise: RegexSyntaxError;<br>
+ should: ['*?' asRegex] raise: RegexSyntaxError;<br>
+ should: ['a{1,2}?' asRegex] raise: RegexSyntaxError.<br>
+ <br>
+ "Unless we add support for possessive quantifiers, the following should raise a syntax error."<br>
+ self<br>
+ should: ['a?+' asRegex] raise: RegexSyntaxError;<br>
+ should: ['a++' asRegex] raise: RegexSyntaxError;<br>
+ should: ['a*+' asRegex] raise: RegexSyntaxError;<br>
+ should: ['a{1,2}+' asRegex] raise: RegexSyntaxError.<br>
+ <br>
+ "The following does not make sense under any circumstances."<br>
+ self<br>
+ should: ['a?*' asRegex] raise: RegexSyntaxError;<br>
+ should: ['a+*' asRegex] raise: RegexSyntaxError;<br>
+ should: ['a**' asRegex] raise: RegexSyntaxError.<br>
+ self<br>
+ should: ['a{1,2}{3,4}' asRegex] raise: RegexSyntaxError;<br>
+ should: ['a?{1,2}' asRegex] raise: RegexSyntaxError;<br>
+ should: ['a+{1,2}' asRegex] raise: RegexSyntaxError;<br>
+ should: ['a*{1,2}' asRegex] raise: RegexSyntaxError.</font><br>
<br>
<b>RxParserTest>>testRegexSyntaxErrorPosition {tests} · ct 10/28/2021 03:14</b><br>
<font color="#FF0000">+ testRegexSyntaxErrorPosition<br>
+ <br>
+ | position |<br>
+ ['a::z' asRegex] on: RegexSyntaxError do: [:ex | position := ex position].<br>
+ self assert: 3 equals: position.<br>
+ ['a[b[:space:_]y]z' asRegex] on: RegexSyntaxError do: [:ex | position := ex position].<br>
+ self assert: 12 equals: position.<br>
+ ['a[^][::]]z' asRegex] on: RegexSyntaxError do: [:ex | position := ex position].<br>
+ self assert: 8 equals: position.<br>
+ <br>
+ "During nested parsing, the global position must be provided"<br>
+ ['a\x{}z' asRegex] on: RegexSyntaxError do: [:ex | position := ex position].<br>
+ self assert: 5 equals: position.<br>
+ ['a[b\x{}y]z' asRegex] on: RegexSyntaxError do: [:ex | position := ex position].<br>
+ self assert: 7 equals: position.<br>
+ ['a[^b\x{}y]z' asRegex] on: RegexSyntaxError do: [:ex | position := ex position].<br>
+ self assert: 8 equals: position.</font><br>
<br>
<b>RxParserTest>>testSpecialCharacterInSetRange {tests} · ct 10/21/2021 01:08 (changed)</b><br>
testSpecialCharacterInSetRange<br>
"self debug: #testSpecialCharacterInSetRange"<br>
<br>
"Special characters within a set are `^', `-', and `]' that closes the<br>
set. Below are the examples of how to literally use them in a set:<br>
[01^] -- put the caret anywhere except the beginning<br>
[01-] -- put the dash as the last character<br>
[]01] -- put the closing bracket as the first character <br>
[^]01] (thus, empty and universal sets cannot be specified)"<br>
<br>
self assert: ('0' matchesRegex: '[01^]').<br>
self assert: ('1' matchesRegex: '[01^]').<br>
self assert: ('^' matchesRegex: '[01^]').<br>
<br>
self deny: ('0' matchesRegex: '[^01]').<br>
self deny: ('1' matchesRegex: '[^01]').<br>
<br>
"[^abc] means that everything except abc is matche"<br>
self assert: ('^' matchesRegex: '[^01]').<br>
<s><font color="#0000FF">- <br>
</font></s><font color="#FF0000">+ <br>
+ "[1-7] is the range of all digits between 1 and 7"<br>
+ self assert: ('3' matchesRegex: '[1-7]').</font><br>
<br>
<b>RxParserTest>>testUnicodeCategory {tests} · ct 10/5/2022 19:38</b><br>
<font color="#FF0000">+ testUnicodeCategory<br>
+ <br>
+ self assert: ['X' matchesRegex: '\p{Lu}'].<br>
+ self assert: ['X' matchesRegex: '\p{L}'].<br>
+ self deny: ['X' matchesRegex: '\p{Ll}'].<br>
+ self assert: ['x' matchesRegex: '\p{Ll}'].<br>
+ self assert: ['x' matchesRegex: '\p{L}'].<br>
+ self deny: ['x' matchesRegex: '\p{Lu}'].<br>
+ <br>
+ self deny: ['X' matchesRegex: '\P{Lu}'].<br>
+ self deny: ['X' matchesRegex: '\P{L}'].<br>
+ self assert: ['X' matchesRegex: '\P{Ll}'].<br>
+ self deny: ['x' matchesRegex: '\P{Ll}'].<br>
+ self deny: ['x' matchesRegex: '\P{L}'].<br>
+ self assert: ['x' matchesRegex: '\P{Lu}'].<br>
+ <br>
+ self assert: ['x' matchesRegex: '[\p{L}]'].<br>
+ self deny: ['x' matchesRegex: '[\P{L}]'].<br>
+ self assert: ['x' matchesRegex: '[^\P{L}]'].<br>
+ <br>
+ self should: ['x' matchesRegex: '[\p{LoremIpsum}]'] raise: RegexSyntaxError.</font><br>
<br>
<b>RxParserTest>>toDotestSpecialCharacterInSetRange {tests} · sd 9/4/2006 23:29 (removed)</b><br>
<s><font color="#0000FF">- toDotestSpecialCharacterInSetRange<br>
- "self debug: #testSpecialCharacterInSetRange"<br>
- <br>
- "Special characters within a set are `^', `-', and `]' that closes the<br>
- set. Below are the examples of how to literally use them in a set:<br>
- [01^] -- put the caret anywhere except the beginning<br>
- [01-] -- put the dash as the last character<br>
- []01] -- put the closing bracket as the first character <br>
- [^]01] (thus, empty and universal sets cannot be specified)"<br>
- <br>
- self assert: ('0' matchesRegex: '[01^]').<br>
- <br>
- self assert: ('0' matchesRegex: '[0-9]'). <br>
- </font></s><br>
<br>
<br>
<font color="#808080">---<br>
</font><font color="#808080"><i>Sent from </i></font><font color="#808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><font color="#808080">Squeak Inbox Talk</font></u></a></i></font>