@@ -123,14 +123,30 @@ def obj.to_str() [] end
123
123
( r . options & Regexp ::EXTENDED ) . should_not == 0
124
124
end
125
125
126
- it "does not try to convert the second argument to Integer with #to_int method call" do
127
- ScratchPad . clear
128
- obj = Object . new
129
- def obj . to_int ( ) ScratchPad . record ( :called ) end
126
+ ruby_version_is "" ..."3.2" do
127
+ it "does not try to convert the second argument to Integer with #to_int method call" do
128
+ ScratchPad . clear
129
+ obj = Object . new
130
+ def obj . to_int ( ) ScratchPad . record ( :called ) end
131
+
132
+ Regexp . send ( @method , "Hi" , obj )
130
133
131
- Regexp . send ( @method , "Hi" , obj )
134
+ ScratchPad . recorded . should == nil
135
+ end
136
+ end
132
137
133
- ScratchPad . recorded . should == nil
138
+ ruby_version_is "3.2" do
139
+ it "does not try to convert the second argument to Integer with #to_int method call" do
140
+ ScratchPad . clear
141
+ obj = Object . new
142
+ def obj . to_int ( ) ScratchPad . record ( :called ) end
143
+
144
+ -> {
145
+ Regexp . send ( @method , "Hi" , obj )
146
+ } . should complain ( /expected true or false as ignorecase/ , { verbose : true } )
147
+
148
+ ScratchPad . recorded . should == nil
149
+ end
134
150
end
135
151
136
152
ruby_version_is "" ..."3.2" do
@@ -188,12 +204,12 @@ def obj.to_int() ScratchPad.record(:called) end
188
204
end
189
205
190
206
it "raises an Argument error if the second argument contains unsupported chars" do
191
- -> { Regexp . send ( @method , 'Hi' , 'e' ) } . should raise_error ( ArgumentError )
192
- -> { Regexp . send ( @method , 'Hi' , 'n' ) } . should raise_error ( ArgumentError )
193
- -> { Regexp . send ( @method , 'Hi' , 's' ) } . should raise_error ( ArgumentError )
194
- -> { Regexp . send ( @method , 'Hi' , 'u' ) } . should raise_error ( ArgumentError )
195
- -> { Regexp . send ( @method , 'Hi' , 'j' ) } . should raise_error ( ArgumentError )
196
- -> { Regexp . send ( @method , 'Hi' , 'mjx' ) } . should raise_error ( ArgumentError )
207
+ -> { Regexp . send ( @method , 'Hi' , 'e' ) } . should raise_error ( ArgumentError , "unknown regexp option: e" )
208
+ -> { Regexp . send ( @method , 'Hi' , 'n' ) } . should raise_error ( ArgumentError , "unknown regexp option: n" )
209
+ -> { Regexp . send ( @method , 'Hi' , 's' ) } . should raise_error ( ArgumentError , "unknown regexp option: s" )
210
+ -> { Regexp . send ( @method , 'Hi' , 'u' ) } . should raise_error ( ArgumentError , "unknown regexp option: u" )
211
+ -> { Regexp . send ( @method , 'Hi' , 'j' ) } . should raise_error ( ArgumentError , "unknown regexp option: j" )
212
+ -> { Regexp . send ( @method , 'Hi' , 'mjx' ) } . should raise_error ( ArgumentError , /unknown regexp option: mjx \b / )
197
213
end
198
214
end
199
215
0 commit comments