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/array/pack/shared | |
parent | a06301b103371b0b7da8eaca26ba744961769f99 (diff) |
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/array/pack/shared')
-rw-r--r-- | spec/ruby/core/array/pack/shared/basic.rb | 10 | ||||
-rw-r--r-- | spec/ruby/core/array/pack/shared/encodings.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/array/pack/shared/float.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/array/pack/shared/numeric_basic.rb | 14 | ||||
-rw-r--r-- | spec/ruby/core/array/pack/shared/string.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/array/pack/shared/unicode.rb | 6 |
6 files changed, 24 insertions, 24 deletions
diff --git a/spec/ruby/core/array/pack/shared/basic.rb b/spec/ruby/core/array/pack/shared/basic.rb index 39ab15308d..bc366987c8 100644 --- a/spec/ruby/core/array/pack/shared/basic.rb +++ b/spec/ruby/core/array/pack/shared/basic.rb @@ -1,6 +1,6 @@ describe :array_pack_arguments, shared: true do it "raises an ArgumentError if there are fewer elements than the format requires" do - lambda { [].pack(pack_format(1)) }.should raise_error(ArgumentError) + -> { [].pack(pack_format(1)) }.should raise_error(ArgumentError) end end @@ -10,11 +10,11 @@ describe :array_pack_basic, shared: true do end it "raises a TypeError when passed nil" do - lambda { [@obj].pack(nil) }.should raise_error(TypeError) + -> { [@obj].pack(nil) }.should raise_error(TypeError) end it "raises a TypeError when passed an Integer" do - lambda { [@obj].pack(1) }.should raise_error(TypeError) + -> { [@obj].pack(1) }.should raise_error(TypeError) end end @@ -56,10 +56,10 @@ end describe :array_pack_no_platform, shared: true do it "raises ArgumentError when the format modifier is '_'" do - lambda{ [1].pack(pack_format("_")) }.should raise_error(ArgumentError) + ->{ [1].pack(pack_format("_")) }.should raise_error(ArgumentError) end it "raises ArgumentError when the format modifier is '!'" do - lambda{ [1].pack(pack_format("!")) }.should raise_error(ArgumentError) + ->{ [1].pack(pack_format("!")) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/core/array/pack/shared/encodings.rb b/spec/ruby/core/array/pack/shared/encodings.rb index 3724a5d859..6b7ffac764 100644 --- a/spec/ruby/core/array/pack/shared/encodings.rb +++ b/spec/ruby/core/array/pack/shared/encodings.rb @@ -5,12 +5,12 @@ describe :array_pack_hex, shared: true do it "raises a TypeError if the object does not respond to #to_str" do obj = mock("pack hex non-string") - lambda { [obj].pack(pack_format) }.should raise_error(TypeError) + -> { [obj].pack(pack_format) }.should raise_error(TypeError) end it "raises a TypeError if #to_str does not return a String" do obj = mock("pack hex non-string") obj.should_receive(:to_str).and_return(1) - lambda { [obj].pack(pack_format) }.should raise_error(TypeError) + -> { [obj].pack(pack_format) }.should raise_error(TypeError) end end diff --git a/spec/ruby/core/array/pack/shared/float.rb b/spec/ruby/core/array/pack/shared/float.rb index 6cd326ce9c..c6b194007f 100644 --- a/spec/ruby/core/array/pack/shared/float.rb +++ b/spec/ruby/core/array/pack/shared/float.rb @@ -14,7 +14,7 @@ describe :array_pack_float_le, shared: true do end it "raises a TypeError if passed a String representation of a floating point number" do - lambda { ["13"].pack(pack_format) }.should raise_error(TypeError) + -> { ["13"].pack(pack_format) }.should raise_error(TypeError) end it "encodes the number of array elements specified by the count modifier" do @@ -69,7 +69,7 @@ describe :array_pack_float_be, shared: true do end it "raises a TypeError if passed a String representation of a floating point number" do - lambda { ["13"].pack(pack_format) }.should raise_error(TypeError) + -> { ["13"].pack(pack_format) }.should raise_error(TypeError) end it "encodes the number of array elements specified by the count modifier" do @@ -124,7 +124,7 @@ describe :array_pack_double_le, shared: true do end it "raises a TypeError if passed a String representation of a floating point number" do - lambda { ["13"].pack(pack_format) }.should raise_error(TypeError) + -> { ["13"].pack(pack_format) }.should raise_error(TypeError) end it "encodes the number of array elements specified by the count modifier" do @@ -183,7 +183,7 @@ describe :array_pack_double_be, shared: true do end it "raises a TypeError if passed a String representation of a floating point number" do - lambda { ["13"].pack(pack_format) }.should raise_error(TypeError) + -> { ["13"].pack(pack_format) }.should raise_error(TypeError) end it "encodes the number of array elements specified by the count modifier" do diff --git a/spec/ruby/core/array/pack/shared/numeric_basic.rb b/spec/ruby/core/array/pack/shared/numeric_basic.rb index 3ebdbc4c1a..7c36ba4a32 100644 --- a/spec/ruby/core/array/pack/shared/numeric_basic.rb +++ b/spec/ruby/core/array/pack/shared/numeric_basic.rb @@ -4,15 +4,15 @@ describe :array_pack_numeric_basic, shared: true do end it "raises a TypeError when passed nil" do - lambda { [nil].pack(pack_format) }.should raise_error(TypeError) + -> { [nil].pack(pack_format) }.should raise_error(TypeError) end it "raises a TypeError when passed true" do - lambda { [true].pack(pack_format) }.should raise_error(TypeError) + -> { [true].pack(pack_format) }.should raise_error(TypeError) end it "raises a TypeError when passed false" do - lambda { [false].pack(pack_format) }.should raise_error(TypeError) + -> { [false].pack(pack_format) }.should raise_error(TypeError) end it "returns a binary string" do @@ -24,21 +24,21 @@ end describe :array_pack_integer, shared: true do it "raises a TypeError when the object does not respond to #to_int" do obj = mock('not an integer') - lambda { [obj].pack(pack_format) }.should raise_error(TypeError) + -> { [obj].pack(pack_format) }.should raise_error(TypeError) end it "raises a TypeError when passed a String" do - lambda { ["5"].pack(pack_format) }.should raise_error(TypeError) + -> { ["5"].pack(pack_format) }.should raise_error(TypeError) end end describe :array_pack_float, shared: true do it "raises a TypeError if a String does not represent a floating point number" do - lambda { ["a"].pack(pack_format) }.should raise_error(TypeError) + -> { ["a"].pack(pack_format) }.should raise_error(TypeError) end it "raises a TypeError when the object does not respond to #to_f" do obj = mock('not an float') - lambda { [obj].pack(pack_format) }.should raise_error(TypeError) + -> { [obj].pack(pack_format) }.should raise_error(TypeError) end end diff --git a/spec/ruby/core/array/pack/shared/string.rb b/spec/ruby/core/array/pack/shared/string.rb index 98e8c4d562..8c82e8c617 100644 --- a/spec/ruby/core/array/pack/shared/string.rb +++ b/spec/ruby/core/array/pack/shared/string.rb @@ -17,11 +17,11 @@ describe :array_pack_string, shared: true do end it "raises an ArgumentError when the Array is empty" do - lambda { [].pack(pack_format) }.should raise_error(ArgumentError) + -> { [].pack(pack_format) }.should raise_error(ArgumentError) end it "raises an ArgumentError when the Array has too few elements" do - lambda { ["a"].pack(pack_format(nil, 2)) }.should raise_error(ArgumentError) + -> { ["a"].pack(pack_format(nil, 2)) }.should raise_error(ArgumentError) end it "calls #to_str to convert the element to a String" do @@ -33,7 +33,7 @@ describe :array_pack_string, shared: true do it "raises a TypeError when the object does not respond to #to_str" do obj = mock("not a string") - lambda { [obj].pack(pack_format) }.should raise_error(TypeError) + -> { [obj].pack(pack_format) }.should raise_error(TypeError) end it "returns a string in encoding of common to the concatenated results" do diff --git a/spec/ruby/core/array/pack/shared/unicode.rb b/spec/ruby/core/array/pack/shared/unicode.rb index e16110c491..dd0f8b38aa 100644 --- a/spec/ruby/core/array/pack/shared/unicode.rb +++ b/spec/ruby/core/array/pack/shared/unicode.rb @@ -64,7 +64,7 @@ describe :array_pack_unicode, shared: true do it "raises a TypeError if #to_int does not return an Integer" do obj = mock('to_int') obj.should_receive(:to_int).and_return("5") - lambda { [obj].pack("U") }.should raise_error(TypeError) + -> { [obj].pack("U") }.should raise_error(TypeError) end it "ignores NULL bytes between directives" do @@ -76,11 +76,11 @@ describe :array_pack_unicode, shared: true do end it "raises a RangeError if passed a negative number" do - lambda { [-1].pack("U") }.should raise_error(RangeError) + -> { [-1].pack("U") }.should raise_error(RangeError) end it "raises a RangeError if passed a number larger than an unsigned 32-bit integer" do - lambda { [2**32].pack("U") }.should raise_error(RangeError) + -> { [2**32].pack("U") }.should raise_error(RangeError) end it "sets the output string to UTF-8 encoding" do |