Skip to content

Commit 9b91a48

Browse files
committed
Remove tests do not test Regexp methods
The backslashs in these tests are parsed as escapes in string literals by the parser, but not passed to the `Regexp` methods.
1 parent 5e90d9e commit 9b91a48

1 file changed

Lines changed: 1 addition & 240 deletions

File tree

  • spec/ruby/core/regexp/shared

spec/ruby/core/regexp/shared/new.rb

Lines changed: 1 addition & 240 deletions
Original file line numberDiff line numberDiff line change
@@ -195,190 +195,14 @@ def obj.to_int() ScratchPad.record(:called) end
195195
-> { Regexp.send(@method, "\\\\") }.should_not raise_error(RegexpError)
196196
end
197197

198-
it "accepts a backspace followed by a character" do
198+
it "accepts a backspace followed by a non-special character" do
199199
Regexp.send(@method, "\\N").should == /#{"\x5c"+"N"}/
200200
end
201201

202-
it "accepts a one-digit octal value" do
203-
Regexp.send(@method, "\0").should == /#{"\x00"}/
204-
end
205-
206-
it "accepts a two-digit octal value" do
207-
Regexp.send(@method, "\11").should == /#{"\x09"}/
208-
end
209-
210-
it "accepts a one-digit hexadecimal value" do
211-
Regexp.send(@method, "\x9n").should == /#{"\x09n"}/
212-
end
213-
214-
it "accepts a two-digit hexadecimal value" do
215-
Regexp.send(@method, "\x23").should == /#{"\x23"}/
216-
end
217-
218-
it "interprets a digit following a two-digit hexadecimal value as a character" do
219-
Regexp.send(@method, "\x420").should == /#{"\x420"}/
220-
end
221-
222202
it "raises a RegexpError if \\x is not followed by any hexadecimal digits" do
223203
-> { Regexp.send(@method, "\\" + "xn") }.should raise_error(RegexpError, Regexp.new(Regexp.escape("invalid hex escape: /\\xn/")))
224204
end
225205

226-
it "accepts an escaped string interpolation" do
227-
Regexp.send(@method, "\#{abc}").should == /#{"\#{abc}"}/
228-
end
229-
230-
it "accepts '\\n'" do
231-
Regexp.send(@method, "\n").should == /#{"\x0a"}/
232-
end
233-
234-
it "accepts '\\t'" do
235-
Regexp.send(@method, "\t").should == /#{"\x09"}/
236-
end
237-
238-
it "accepts '\\r'" do
239-
Regexp.send(@method, "\r").should == /#{"\x0d"}/
240-
end
241-
242-
it "accepts '\\f'" do
243-
Regexp.send(@method, "\f").should == /#{"\x0c"}/
244-
end
245-
246-
it "accepts '\\v'" do
247-
Regexp.send(@method, "\v").should == /#{"\x0b"}/
248-
end
249-
250-
it "accepts '\\a'" do
251-
Regexp.send(@method, "\a").should == /#{"\x07"}/
252-
end
253-
254-
it "accepts '\\e'" do
255-
Regexp.send(@method, "\e").should == /#{"\x1b"}/
256-
end
257-
258-
it "accepts '\\C-\\n'" do
259-
Regexp.send(@method, "\C-\n").should == /#{"\x0a"}/
260-
end
261-
262-
it "accepts '\\C-\\t'" do
263-
Regexp.send(@method, "\C-\t").should == /#{"\x09"}/
264-
end
265-
266-
it "accepts '\\C-\\r'" do
267-
Regexp.send(@method, "\C-\r").should == /#{"\x0d"}/
268-
end
269-
270-
it "accepts '\\C-\\f'" do
271-
Regexp.send(@method, "\C-\f").should == /#{"\x0c"}/
272-
end
273-
274-
it "accepts '\\C-\\v'" do
275-
Regexp.send(@method, "\C-\v").should == /#{"\x0b"}/
276-
end
277-
278-
it "accepts '\\C-\\a'" do
279-
Regexp.send(@method, "\C-\a").should == /#{"\x07"}/
280-
end
281-
282-
it "accepts '\\C-\\e'" do
283-
Regexp.send(@method, "\C-\e").should == /#{"\x1b"}/
284-
end
285-
286-
it "accepts multiple consecutive '\\' characters" do
287-
Regexp.send(@method, "\\\\\\N").should == /#{"\\\\\\"+"N"}/
288-
end
289-
290-
it "accepts characters and escaped octal digits" do
291-
Regexp.send(@method, "abc\076").should == /#{"abc\x3e"}/
292-
end
293-
294-
it "accepts escaped octal digits and characters" do
295-
Regexp.send(@method, "\076abc").should == /#{"\x3eabc"}/
296-
end
297-
298-
it "accepts characters and escaped hexadecimal digits" do
299-
Regexp.send(@method, "abc\x42").should == /#{"abc\x42"}/
300-
end
301-
302-
it "accepts escaped hexadecimal digits and characters" do
303-
Regexp.send(@method, "\x3eabc").should == /#{"\x3eabc"}/
304-
end
305-
306-
it "accepts escaped hexadecimal and octal digits" do
307-
Regexp.send(@method, "\061\x42").should == /#{"\x31\x42"}/
308-
end
309-
310-
it "accepts \\u{H} for a single Unicode codepoint" do
311-
Regexp.send(@method, "\u{f}").should == /#{"\x0f"}/
312-
end
313-
314-
it "accepts \\u{HH} for a single Unicode codepoint" do
315-
Regexp.send(@method, "\u{7f}").should == /#{"\x7f"}/
316-
end
317-
318-
it "accepts \\u{HHH} for a single Unicode codepoint" do
319-
Regexp.send(@method, "\u{07f}").should == /#{"\x7f"}/
320-
end
321-
322-
it "accepts \\u{HHHH} for a single Unicode codepoint" do
323-
Regexp.send(@method, "\u{0000}").should == /#{"\x00"}/
324-
end
325-
326-
it "accepts \\u{HHHHH} for a single Unicode codepoint" do
327-
Regexp.send(@method, "\u{00001}").should == /#{"\x01"}/
328-
end
329-
330-
it "accepts \\u{HHHHHH} for a single Unicode codepoint" do
331-
Regexp.send(@method, "\u{000000}").should == /#{"\x00"}/
332-
end
333-
334-
it "accepts characters followed by \\u{HHHH}" do
335-
Regexp.send(@method, "abc\u{3042}").should == /#{"abc\u3042"}/
336-
end
337-
338-
it "accepts \\u{HHHH} followed by characters" do
339-
Regexp.send(@method, "\u{3042}abc").should == /#{"\u3042abc"}/
340-
end
341-
342-
it "accepts escaped hexadecimal digits followed by \\u{HHHH}" do
343-
Regexp.send(@method, "\x42\u{3042}").should == /#{"\x42\u3042"}/
344-
end
345-
346-
it "accepts escaped octal digits followed by \\u{HHHH}" do
347-
Regexp.send(@method, "\056\u{3042}").should == /#{"\x2e\u3042"}/
348-
end
349-
350-
it "accepts a combination of escaped octal and hexadecimal digits and \\u{HHHH}" do
351-
Regexp.send(@method, "\056\x42\u{3042}\x52\076").should == /#{"\x2e\x42\u3042\x52\x3e"}/
352-
end
353-
354-
it "accepts \\uHHHH for a single Unicode codepoint" do
355-
Regexp.send(@method, "\u3042").should == /#{"\u3042"}/
356-
end
357-
358-
it "accepts characters followed by \\uHHHH" do
359-
Regexp.send(@method, "abc\u3042").should == /#{"abc\u3042"}/
360-
end
361-
362-
it "accepts \\uHHHH followed by characters" do
363-
Regexp.send(@method, "\u3042abc").should == /#{"\u3042abc"}/
364-
end
365-
366-
it "accepts escaped hexadecimal digits followed by \\uHHHH" do
367-
Regexp.send(@method, "\x42\u3042").should == /#{"\x42\u3042"}/
368-
end
369-
370-
it "accepts escaped octal digits followed by \\uHHHH" do
371-
Regexp.send(@method, "\056\u3042").should == /#{"\x2e\u3042"}/
372-
end
373-
374-
it "accepts a combination of escaped octal and hexadecimal digits and \\uHHHH" do
375-
Regexp.send(@method, "\056\x42\u3042\x52\076").should == /#{"\x2e\x42\u3042\x52\x3e"}/
376-
end
377-
378-
it "accepts a multiple byte character which need not be escaped" do
379-
Regexp.send(@method, "").should == /#{"§"}/
380-
end
381-
382206
it "raises a RegexpError if less than four digits are given for \\uHHHH" do
383207
-> { Regexp.send(@method, "\\" + "u304") }.should raise_error(RegexpError, Regexp.new(Regexp.escape("invalid Unicode escape: /\\u304/")))
384208
end
@@ -433,69 +257,6 @@ def obj.to_int() ScratchPad.record(:called) end
433257

434258
describe :regexp_new_string_binary, shared: true do
435259
describe "with escaped characters" do
436-
it "accepts a three-digit octal value" do
437-
Regexp.send(@method, "\315").should == /#{"\xcd"}/
438-
end
439-
440-
it "interprets a digit following a three-digit octal value as a character" do
441-
Regexp.send(@method, "\3762").should == /#{"\xfe2"}/
442-
end
443-
444-
it "accepts '\\M-\\n'" do
445-
Regexp.send(@method, "\M-\n").should == /#{"\x8a"}/
446-
end
447-
448-
it "accepts '\\M-\\t'" do
449-
Regexp.send(@method, "\M-\t").should == /#{"\x89"}/
450-
end
451-
452-
it "accepts '\\M-\\r'" do
453-
Regexp.send(@method, "\M-\r").should == /#{"\x8d"}/
454-
end
455-
456-
it "accepts '\\M-\\f'" do
457-
Regexp.send(@method, "\M-\f").should == /#{"\x8c"}/
458-
end
459-
460-
it "accepts '\\M-\\v'" do
461-
Regexp.send(@method, "\M-\v").should == /#{"\x8b"}/
462-
end
463-
464-
it "accepts '\\M-\\a'" do
465-
Regexp.send(@method, "\M-\a").should == /#{"\x87"}/
466-
end
467-
468-
it "accepts '\\M-\\e'" do
469-
Regexp.send(@method, "\M-\e").should == /#{"\x9b"}/
470-
end
471-
472-
it "accepts '\\M-\\C-\\n'" do
473-
Regexp.send(@method, "\M-\C-\n").should == /#{"\x8a"}/
474-
end
475-
476-
it "accepts '\\M-\\C-\\t'" do
477-
Regexp.send(@method, "\M-\C-\t").should == /#{"\x89"}/
478-
end
479-
480-
it "accepts '\\M-\\C-\\r'" do
481-
Regexp.send(@method, "\M-\C-\r").should == /#{"\x8d"}/
482-
end
483-
484-
it "accepts '\\M-\\C-\\f'" do
485-
Regexp.send(@method, "\M-\C-\f").should == /#{"\x8c"}/
486-
end
487-
488-
it "accepts '\\M-\\C-\\v'" do
489-
Regexp.send(@method, "\M-\C-\v").should == /#{"\x8b"}/
490-
end
491-
492-
it "accepts '\\M-\\C-\\a'" do
493-
Regexp.send(@method, "\M-\C-\a").should == /#{"\x87"}/
494-
end
495-
496-
it "accepts '\\M-\\C-\\e'" do
497-
Regexp.send(@method, "\M-\C-\e").should == /#{"\x9b"}/
498-
end
499260
end
500261
end
501262

0 commit comments

Comments
 (0)