[squeak-dev] The Inbox: Regex-Tests-Core-ct.26.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Oct 20 22:36:11 UTC 2021


A new version of Regex-Tests-Core was added to project The Inbox:
http://source.squeak.org/inbox/Regex-Tests-Core-ct.26.mcz

==================== Summary ====================

Name: Regex-Tests-Core-ct.26
Author: ct
Time: 21 October 2021, 12:36:10.301482 am
UUID: daca8d0c-47a2-564e-8153-cca4ffb401a4
Ancestors: Regex-Tests-Core-mt.16

Tests nullable closures that are introduced in Regex-Core-ct.70.

Note that #testHenry142 and #testHenry146 will time out until Regex-Core-ct.62 is loaded (fixes copying of cyclic RxmLink structures).
The second match in #testLookaroundNullable currently fails for the same reason as #testOptionalLookbehind2; see Regex-Tests-Core-ct.14.

=============== Diff against Regex-Tests-Core-mt.16 ===============

Item was changed:
  ----- Method: RxMatcherTest>>runMatcher:with:expect:withSubexpressions: (in category 'utilties') -----
  runMatcher: aMatcher with: aString expect: aBoolean withSubexpressions: anArray
  	| copy got |
  	copy := aMatcher
  		copy: aString
  		translatingMatchesUsing: [ :each | each ].
  	self 
  		assert: copy = aString
  		description: 'Copying: expected ' , aString printString , ', but got ' , copy printString.
  	got := aMatcher search: aString.
  	self
  		assert: got = aBoolean 
  		description: 'Searching: expected ' , aBoolean printString , ', but got ' , got printString.
  	(anArray isNil or: [ aMatcher supportsSubexpressions not ])
  		ifTrue: [ ^ self ].
  	1 to: anArray size by: 2 do: [ :index |
  		| sub subExpect subGot |
  		sub := anArray at: index.
  		subExpect := anArray at: index + 1.
+ 		subGot := (subExpect isNil or: [subExpect isString])
+ 			ifTrue: [aMatcher subexpression: sub]
+ 			ifFalse: [aMatcher subexpressions: sub].
- 		subGot := aMatcher subexpression: sub.
  		self
  			assert: subExpect = subGot
  			description: 'Subexpression ' , sub printString , ': expected ' , subExpect printString , ', but got ' , subGot printString ]!

Item was changed:
  ----- Method: RxMatcherTest>>testHenry071 (in category 'testing-henry') -----
  testHenry071
+ 	self runRegex: #('^()*$' '' true (1 '' 2 ('')))!
- 	self runRegex: #('()*' nil)!

Item was changed:
  ----- Method: RxMatcherTest>>testHenry073 (in category 'testing-henry') -----
  testHenry073
+ 	self runRegex: #('^*' '' true nil)!
- 	self runRegex: #('^*' nil)!

Item was changed:
  ----- Method: RxMatcherTest>>testHenry074 (in category 'testing-henry') -----
  testHenry074
+ 	self runRegex: #('$*' '' true nil)!
- 	self runRegex: #('$*' nil)!

Item was changed:
  ----- Method: RxMatcherTest>>testHenry088 (in category 'testing-henry') -----
  testHenry088
+ 	self runRegex: #('^(a*)*a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 (''))
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa')))!
- 	self runRegex: #('(a*)*' nil)!

Item was changed:
  ----- Method: RxMatcherTest>>testHenry089 (in category 'testing-henry') -----
  testHenry089
+ 	self runRegex: #('^(a*)+a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 (''))
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa')))!
- 	self runRegex: #('(a*)+' nil)!

Item was changed:
  ----- Method: RxMatcherTest>>testHenry090 (in category 'testing-henry') -----
  testHenry090
+ 	self runRegex: #('(a|)*'
+ 		'' true (1 '')
+ 		'a' true (1 'a' 2 ('a'))
+ 		'aa' true (1 'aa' 2 ('a' 'a')))!
- 	self runRegex: #('(a|)*' nil)!

Item was changed:
  ----- Method: RxMatcherTest>>testHenry091 (in category 'testing-henry') -----
  testHenry091
+ 	self runRegex: #('(a*|b)*$'
+ 		'' true (1 '')
+ 		'a' true (1 'a' 2 ('a'))
+ 		'aa' true (1 'aa' 2 ('aa'))
+ 		'bb' true (1 'bb' 2 ('b' 'b'))
+ 		'aabba' true (1 'aabba' 2 ('aa' 'b' 'b' 'a')))!
- 	self runRegex: #('(a*|b)*' nil)!

Item was changed:
  ----- Method: RxMatcherTest>>testHenry096 (in category 'testing-henry') -----
  testHenry096
+ 	self runRegex: #('(^)*'
+ 		'' true (1 '' 2 '')
+ 		'a' true (1 '' 2 ''))!
- 	self runRegex: #('(^)*' nil)!

Item was changed:
  ----- Method: RxMatcherTest>>testHenry097 (in category 'testing-henry') -----
  testHenry097
+ 	self runRegex: #('(ab|)*'
+ 		'' true (1 '' 2 '')
+ 		'ab' true (1 'ab' 2 ('ab'))
+ 		'abab' true (1 'abab' 2 ('ab' 'ab')))!
- 	self runRegex: #('(ab|)*' nil)!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry138 (in category 'testing-henry') -----
+ testHenry138
+ 	self runRegex: #('(a|b?)?'
+ 		'' true (1 '' 2 (''))
+ 		'a' true (1 'a' 2 ('a'))
+ 		'b' true (1 'b' 2 ('b'))
+ 		'ab' false)!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry141 (in category 'testing-henry') -----
+ testHenry141
+ 	self runRegex: #('^(a*)?a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 (''))
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry142 (in category 'testing-henry') -----
+ testHenry142
+ 	self runRegex: #('^(a*){1,2}a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 ('' ''))
+ 		'aa' true (1 'aa' 2 ('a' ''))
+ 		'aaa' true (1 'aaa' 2 ('aa' '')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry143 (in category 'testing-henry') -----
+ testHenry143
+ 	self runRegex: #('^(a+)*a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 ())
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry144 (in category 'testing-henry') -----
+ testHenry144
+ 	self runRegex: #('^(a+)+a$'
+ 		'' false nil
+ 		'a' false nil
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry145 (in category 'testing-henry') -----
+ testHenry145
+ 	self runRegex: #('^(a+)?a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 ())
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry146 (in category 'testing-henry') -----
+ testHenry146
+ 	self runRegex: #('^(a+){1,2}a$'
+ 		'' false nil
+ 		'a' false nil
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry147 (in category 'testing-henry') -----
+ testHenry147
+ 	self runRegex: #('^(a?)*a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 (''))
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('a' 'a')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry148 (in category 'testing-henry') -----
+ testHenry148
+ 	self runRegex: #('^(a?)+a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 (''))
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('a' 'a')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry149 (in category 'testing-henry') -----
+ testHenry149
+ 	self runRegex: #('^(a?)?a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 (''))
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' false nil)!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry150 (in category 'testing-henry') -----
+ testHenry150
+ 	self runRegex: #('^(a?){1,2}a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 ('' ''))
+ 		'aa' true (1 'aa' 2 ('a' ''))
+ 		'aaa' true (1 'aaa' 2 ('a' 'a')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry151 (in category 'testing-henry') -----
+ testHenry151
+ 	self runRegex: #('^(a{1,2})*a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 ())
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa'))
+ 		'aaaa' true (1 'aaaa' 2 ('aa' 'a')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry152 (in category 'testing-henry') -----
+ testHenry152
+ 	self runRegex: #('^(a{1,2})+a$'
+ 		'' false nil
+ 		'a' false nil
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa'))
+ 		'aaaa' true (1 'aaaa' 2 ('aa' 'a')))!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry153 (in category 'testing-henry') -----
+ testHenry153
+ 	self runRegex: #('^(a{1,2})?a$'
+ 		'' false nil
+ 		'a' true (1 'a' 2 nil)
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa'))
+ 		'aaaa' false nil)!

Item was added:
+ ----- Method: RxMatcherTest>>testHenry154 (in category 'testing-henry') -----
+ testHenry154
+ 	self runRegex: #('^(a{1,2}){1,2}a$'
+ 		'' false nil
+ 		'a' false nil
+ 		'aa' true (1 'aa' 2 ('a'))
+ 		'aaa' true (1 'aaa' 2 ('aa'))
+ 		'aaaa' true (1 'aaaa' 2 ('aa' 'a')))!

Item was changed:
  ----- Method: RxParserTest>>testLookaroundNullable (in category 'tests') -----
  testLookaroundNullable
  
+ 	self assert: ('b' matchesRegex: '(?<=a)?b').
+ 	self assert: ('(?<=a)?b' asRegex search: 'ab').!
- 	self should: ['(?<=a)?b' asRegex] raise: RegexSyntaxError.!

Item was changed:
  ----- Method: RxParserTest>>testOrOperator (in category 'tests') -----
  testOrOperator
  	"self debug: #testOrOperator"
  	
  	"The last operator is `|' meaning `or'. It is placed between two
  regular expressions, and the resulting expression matches if one of
  the expressions matches. It has the lowest possible precedence (lower
  than sequencing). For example, `ab*|ba*' means `a followed by any
  number of b's, or b followed by any number of a's':"
  
  	self assert: ('abb' matchesRegex: 'ab*|ba*').  	
  	self assert: ('baa' matchesRegex: 'ab*|ba*').	 	
  	self deny: ('baab' matchesRegex: 'ab*|ba*').
  	
+ 	
+ 	self assert: ('' matchesRegex: '(a|)*').
+ 	self assert: ('a' matchesRegex: '(a|)*').
+ 	self assert: ('aa' matchesRegex: '(a|)*').!
- 
- 	"It is possible to write an expression matching an empty string, for
- example: `a|'.  However, it is an error to apply `*', `+', or `?' to
- such expression: `(a|)*' is an invalid expression."
- 
- 	self should: ['(a|)*' asRegex] raise: Error.
- !



More information about the Squeak-dev mailing list