diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
commit | 5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch) | |
tree | 05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/regexp | |
parent | a06301b103371b0b7da8eaca26ba744961769f99 (diff) | |
download | ruby-5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0.tar.gz |
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/regexp')
-rw-r--r-- | spec/ruby/core/regexp/initialize_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/regexp/match_spec.rb | 10 | ||||
-rw-r--r-- | spec/ruby/core/regexp/new_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/regexp/options_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/regexp/shared/new.rb | 22 | ||||
-rw-r--r-- | spec/ruby/core/regexp/union_spec.rb | 28 |
6 files changed, 35 insertions, 35 deletions
diff --git a/spec/ruby/core/regexp/initialize_spec.rb b/spec/ruby/core/regexp/initialize_spec.rb index 026348b1dd..36fd5c7bf2 100644 --- a/spec/ruby/core/regexp/initialize_spec.rb +++ b/spec/ruby/core/regexp/initialize_spec.rb @@ -6,10 +6,10 @@ describe "Regexp#initialize" do end it "raises a SecurityError on a Regexp literal" do - lambda { //.send(:initialize, "") }.should raise_error(SecurityError) + -> { //.send(:initialize, "") }.should raise_error(SecurityError) end it "raises a TypeError on an initialized non-literal Regexp" do - lambda { Regexp.new("").send(:initialize, "") }.should raise_error(TypeError) + -> { Regexp.new("").send(:initialize, "") }.should raise_error(TypeError) end end diff --git a/spec/ruby/core/regexp/match_spec.rb b/spec/ruby/core/regexp/match_spec.rb index ebbba38211..a68448b39c 100644 --- a/spec/ruby/core/regexp/match_spec.rb +++ b/spec/ruby/core/regexp/match_spec.rb @@ -35,7 +35,7 @@ describe "Regexp#match" do end it "raises a TypeError on an uninitialized Regexp" do - lambda { Regexp.allocate.match('foo') }.should raise_error(TypeError) + -> { Regexp.allocate.match('foo') }.should raise_error(TypeError) end describe "with [string, position]" do @@ -50,7 +50,7 @@ describe "Regexp#match" do it "raises an ArgumentError for an invalid encoding" do x96 = ([150].pack('C')).force_encoding('utf-8') - lambda { /(.).(.)/.match("Hello, #{x96} world!", 1) }.should raise_error(ArgumentError) + -> { /(.).(.)/.match("Hello, #{x96} world!", 1) }.should raise_error(ArgumentError) end end @@ -65,7 +65,7 @@ describe "Regexp#match" do it "raises an ArgumentError for an invalid encoding" do x96 = ([150].pack('C')).force_encoding('utf-8') - lambda { /(.).(.)/.match("Hello, #{x96} world!", -1) }.should raise_error(ArgumentError) + -> { /(.).(.)/.match("Hello, #{x96} world!", -1) }.should raise_error(ArgumentError) end end @@ -98,12 +98,12 @@ describe "Regexp#match" do it "raises TypeError when the given argument cannot be coerced to String" do f = 1 - lambda { /foo/.match(f)[0] }.should raise_error(TypeError) + -> { /foo/.match(f)[0] }.should raise_error(TypeError) end it "raises TypeError when the given argument is an Exception" do f = Exception.new("foo") - lambda { /foo/.match(f)[0] }.should raise_error(TypeError) + -> { /foo/.match(f)[0] }.should raise_error(TypeError) end end diff --git a/spec/ruby/core/regexp/new_spec.rb b/spec/ruby/core/regexp/new_spec.rb index 8259b61714..d2d867b3d3 100644 --- a/spec/ruby/core/regexp/new_spec.rb +++ b/spec/ruby/core/regexp/new_spec.rb @@ -16,12 +16,12 @@ end describe "Regexp.new given a Fixnum" do it "raises a TypeError" do - lambda { Regexp.new(1) }.should raise_error(TypeError) + -> { Regexp.new(1) }.should raise_error(TypeError) end end describe "Regexp.new given a Float" do it "raises a TypeError" do - lambda { Regexp.new(1.0) }.should raise_error(TypeError) + -> { Regexp.new(1.0) }.should raise_error(TypeError) end end diff --git a/spec/ruby/core/regexp/options_spec.rb b/spec/ruby/core/regexp/options_spec.rb index 5fbde89988..fb4853a014 100644 --- a/spec/ruby/core/regexp/options_spec.rb +++ b/spec/ruby/core/regexp/options_spec.rb @@ -29,7 +29,7 @@ describe "Regexp#options" do end it "raises a TypeError on an uninitialized Regexp" do - lambda { Regexp.allocate.options }.should raise_error(TypeError) + -> { Regexp.allocate.options }.should raise_error(TypeError) end it "includes Regexp::FIXEDENCODING for a Regexp literal with the 'u' option" do diff --git a/spec/ruby/core/regexp/shared/new.rb b/spec/ruby/core/regexp/shared/new.rb index ab833ec236..bb5df7bc2e 100644 --- a/spec/ruby/core/regexp/shared/new.rb +++ b/spec/ruby/core/regexp/shared/new.rb @@ -30,7 +30,7 @@ describe :regexp_new_string, shared: true do end it "raises a RegexpError when passed an incorrect regexp" do - lambda { Regexp.send(@method, "^[$", 0) }.should raise_error(RegexpError) + -> { Regexp.send(@method, "^[$", 0) }.should raise_error(RegexpError) end it "does not set Regexp options if only given one argument" do @@ -98,7 +98,7 @@ describe :regexp_new_string, shared: true do end it "ignores the third argument if it is 'e' or 'euc' (case-insensitive)" do - lambda { + -> { Regexp.send(@method, 'Hi', nil, 'e').encoding.should == Encoding::US_ASCII Regexp.send(@method, 'Hi', nil, 'euc').encoding.should == Encoding::US_ASCII Regexp.send(@method, 'Hi', nil, 'E').encoding.should == Encoding::US_ASCII @@ -107,7 +107,7 @@ describe :regexp_new_string, shared: true do end it "ignores the third argument if it is 's' or 'sjis' (case-insensitive)" do - lambda { + -> { Regexp.send(@method, 'Hi', nil, 's').encoding.should == Encoding::US_ASCII Regexp.send(@method, 'Hi', nil, 'sjis').encoding.should == Encoding::US_ASCII Regexp.send(@method, 'Hi', nil, 'S').encoding.should == Encoding::US_ASCII @@ -116,7 +116,7 @@ describe :regexp_new_string, shared: true do end it "ignores the third argument if it is 'u' or 'utf8' (case-insensitive)" do - lambda { + -> { Regexp.send(@method, 'Hi', nil, 'u').encoding.should == Encoding::US_ASCII Regexp.send(@method, 'Hi', nil, 'utf8').encoding.should == Encoding::US_ASCII Regexp.send(@method, 'Hi', nil, 'U').encoding.should == Encoding::US_ASCII @@ -143,11 +143,11 @@ describe :regexp_new_string, shared: true do describe "with escaped characters" do it "raises a Regexp error if there is a trailing backslash" do - lambda { Regexp.send(@method, "\\") }.should raise_error(RegexpError) + -> { Regexp.send(@method, "\\") }.should raise_error(RegexpError) end it "does not raise a Regexp error if there is an escaped trailing backslash" do - lambda { Regexp.send(@method, "\\\\") }.should_not raise_error(RegexpError) + -> { Regexp.send(@method, "\\\\") }.should_not raise_error(RegexpError) end it "accepts a backspace followed by a character" do @@ -175,7 +175,7 @@ describe :regexp_new_string, shared: true do end it "raises a RegexpError if \\x is not followed by any hexadecimal digits" do - lambda { Regexp.send(@method, "\\" + "xn") }.should raise_error(RegexpError) + -> { Regexp.send(@method, "\\" + "xn") }.should raise_error(RegexpError) end it "accepts an escaped string interpolation" do @@ -331,15 +331,15 @@ describe :regexp_new_string, shared: true do end it "raises a RegexpError if less than four digits are given for \\uHHHH" do - lambda { Regexp.send(@method, "\\" + "u304") }.should raise_error(RegexpError) + -> { Regexp.send(@method, "\\" + "u304") }.should raise_error(RegexpError) end it "raises a RegexpError if the \\u{} escape is empty" do - lambda { Regexp.send(@method, "\\" + "u{}") }.should raise_error(RegexpError) + -> { Regexp.send(@method, "\\" + "u{}") }.should raise_error(RegexpError) end it "raises a RegexpError if more than six hexadecimal digits are given" do - lambda { Regexp.send(@method, "\\" + "u{0ffffff}") }.should raise_error(RegexpError) + -> { Regexp.send(@method, "\\" + "u{0ffffff}") }.should raise_error(RegexpError) end it "returns a Regexp with US-ASCII encoding if only 7-bit ASCII characters are present regardless of the input String's encoding" do @@ -475,7 +475,7 @@ describe :regexp_new_regexp, shared: true do it "does not honour options given as additional arguments" do r = nil - lambda { + -> { r = Regexp.send @method, /hi/, Regexp::IGNORECASE }.should complain(/flags ignored/) (r.options & Regexp::IGNORECASE).should == 0 diff --git a/spec/ruby/core/regexp/union_spec.rb b/spec/ruby/core/regexp/union_spec.rb index 25901c6f2b..81a31d89b3 100644 --- a/spec/ruby/core/regexp/union_spec.rb +++ b/spec/ruby/core/regexp/union_spec.rb @@ -52,83 +52,83 @@ describe "Regexp.union" do end it "raises ArgumentError if the arguments include conflicting ASCII-incompatible Strings" do - lambda { + -> { Regexp.union("a".encode("UTF-16LE"), "b".encode("UTF-16BE")) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include conflicting ASCII-incompatible Regexps" do - lambda { + -> { Regexp.union(Regexp.new("a".encode("UTF-16LE")), Regexp.new("b".encode("UTF-16BE"))) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include conflicting fixed encoding Regexps" do - lambda { + -> { Regexp.union(Regexp.new("a".encode("UTF-8"), Regexp::FIXEDENCODING), Regexp.new("b".encode("US-ASCII"), Regexp::FIXEDENCODING)) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include a fixed encoding Regexp and a String containing non-ASCII-compatible characters in a different encoding" do - lambda { + -> { Regexp.union(Regexp.new("a".encode("UTF-8"), Regexp::FIXEDENCODING), "\u00A9".encode("ISO-8859-1")) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include a String containing non-ASCII-compatible characters and a fixed encoding Regexp in a different encoding" do - lambda { + -> { Regexp.union("\u00A9".encode("ISO-8859-1"), Regexp.new("a".encode("UTF-8"), Regexp::FIXEDENCODING)) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include an ASCII-incompatible String and an ASCII-only String" do - lambda { + -> { Regexp.union("a".encode("UTF-16LE"), "b".encode("UTF-8")) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include an ASCII-incompatible Regexp and an ASCII-only String" do - lambda { + -> { Regexp.union(Regexp.new("a".encode("UTF-16LE")), "b".encode("UTF-8")) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include an ASCII-incompatible String and an ASCII-only Regexp" do - lambda { + -> { Regexp.union("a".encode("UTF-16LE"), Regexp.new("b".encode("UTF-8"))) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include an ASCII-incompatible Regexp and an ASCII-only Regexp" do - lambda { + -> { Regexp.union(Regexp.new("a".encode("UTF-16LE")), Regexp.new("b".encode("UTF-8"))) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include an ASCII-incompatible String and a String containing non-ASCII-compatible characters in a different encoding" do - lambda { + -> { Regexp.union("a".encode("UTF-16LE"), "\u00A9".encode("ISO-8859-1")) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include an ASCII-incompatible Regexp and a String containing non-ASCII-compatible characters in a different encoding" do - lambda { + -> { Regexp.union(Regexp.new("a".encode("UTF-16LE")), "\u00A9".encode("ISO-8859-1")) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include an ASCII-incompatible String and a Regexp containing non-ASCII-compatible characters in a different encoding" do - lambda { + -> { Regexp.union("a".encode("UTF-16LE"), Regexp.new("\u00A9".encode("ISO-8859-1"))) }.should raise_error(ArgumentError) end it "raises ArgumentError if the arguments include an ASCII-incompatible Regexp and a Regexp containing non-ASCII-compatible characters in a different encoding" do - lambda { + -> { Regexp.union(Regexp.new("a".encode("UTF-16LE")), Regexp.new("\u00A9".encode("ISO-8859-1"))) }.should raise_error(ArgumentError) end @@ -144,6 +144,6 @@ describe "Regexp.union" do not_supported_on :opal do Regexp.union([/dogs/, /cats/i]).should == /(?-mix:dogs)|(?i-mx:cats)/ end - lambda{Regexp.union(["skiing", "sledding"], [/dogs/, /cats/i])}.should raise_error(TypeError) + ->{Regexp.union(["skiing", "sledding"], [/dogs/, /cats/i])}.should raise_error(TypeError) end end |