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 | |
parent | a06301b103371b0b7da8eaca26ba744961769f99 (diff) |
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/array/pack')
-rw-r--r-- | spec/ruby/core/array/pack/buffer_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/array/pack/m_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/array/pack/percent_spec.rb | 2 | ||||
-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 | ||||
-rw-r--r-- | spec/ruby/core/array/pack/u_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/array/pack/w_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/array/pack/x_spec.rb | 4 |
12 files changed, 37 insertions, 37 deletions
diff --git a/spec/ruby/core/array/pack/buffer_spec.rb b/spec/ruby/core/array/pack/buffer_spec.rb index a3a582996a..ecb40bfd06 100644 --- a/spec/ruby/core/array/pack/buffer_spec.rb +++ b/spec/ruby/core/array/pack/buffer_spec.rb @@ -24,7 +24,7 @@ describe "Array#pack with :buffer option" do end it "raises TypeError exception if buffer is not String" do - lambda { [65].pack("ccc", buffer: []) }.should raise_error( + -> { [65].pack("ccc", buffer: []) }.should raise_error( TypeError, "buffer must be String, not Array") end diff --git a/spec/ruby/core/array/pack/m_spec.rb b/spec/ruby/core/array/pack/m_spec.rb index 40c2e3f1fa..2b1a84abca 100644 --- a/spec/ruby/core/array/pack/m_spec.rb +++ b/spec/ruby/core/array/pack/m_spec.rb @@ -285,16 +285,16 @@ describe "Array#pack with format 'm'" do it "raises a TypeError if #to_str does not return a String" do obj = mock("pack m non-string") - lambda { [obj].pack("m") }.should raise_error(TypeError) + -> { [obj].pack("m") }.should raise_error(TypeError) end it "raises a TypeError if passed nil" do - lambda { [nil].pack("m") }.should raise_error(TypeError) + -> { [nil].pack("m") }.should raise_error(TypeError) end it "raises a TypeError if passed an Integer" do - lambda { [0].pack("m") }.should raise_error(TypeError) - lambda { [bignum_value].pack("m") }.should raise_error(TypeError) + -> { [0].pack("m") }.should raise_error(TypeError) + -> { [bignum_value].pack("m") }.should raise_error(TypeError) end it "does not emit a newline if passed zero as the count modifier" do diff --git a/spec/ruby/core/array/pack/percent_spec.rb b/spec/ruby/core/array/pack/percent_spec.rb index 3c0e7eca0f..5d56dea5fe 100644 --- a/spec/ruby/core/array/pack/percent_spec.rb +++ b/spec/ruby/core/array/pack/percent_spec.rb @@ -2,6 +2,6 @@ require_relative '../../../spec_helper' describe "Array#pack with format '%'" do it "raises an Argument Error" do - lambda { [1].pack("%") }.should raise_error(ArgumentError) + -> { [1].pack("%") }.should raise_error(ArgumentError) end end 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 diff --git a/spec/ruby/core/array/pack/u_spec.rb b/spec/ruby/core/array/pack/u_spec.rb index 8c3eb3a177..fe969cbb2d 100644 --- a/spec/ruby/core/array/pack/u_spec.rb +++ b/spec/ruby/core/array/pack/u_spec.rb @@ -112,16 +112,16 @@ describe "Array#pack with format 'u'" do it "raises a TypeError if #to_str does not return a String" do obj = mock("pack m non-string") - lambda { [obj].pack("u") }.should raise_error(TypeError) + -> { [obj].pack("u") }.should raise_error(TypeError) end it "raises a TypeError if passed nil" do - lambda { [nil].pack("u") }.should raise_error(TypeError) + -> { [nil].pack("u") }.should raise_error(TypeError) end it "raises a TypeError if passed an Integer" do - lambda { [0].pack("u") }.should raise_error(TypeError) - lambda { [bignum_value].pack("u") }.should raise_error(TypeError) + -> { [0].pack("u") }.should raise_error(TypeError) + -> { [bignum_value].pack("u") }.should raise_error(TypeError) end it "sets the output string to US-ASCII encoding" do diff --git a/spec/ruby/core/array/pack/w_spec.rb b/spec/ruby/core/array/pack/w_spec.rb index 889f42bdf7..439fa02198 100644 --- a/spec/ruby/core/array/pack/w_spec.rb +++ b/spec/ruby/core/array/pack/w_spec.rb @@ -33,7 +33,7 @@ describe "Array#pack with format 'w'" do end it "raises an ArgumentError when passed a negative value" do - lambda { [-1].pack("w") }.should raise_error(ArgumentError) + -> { [-1].pack("w") }.should raise_error(ArgumentError) end it "returns a binary string" do diff --git a/spec/ruby/core/array/pack/x_spec.rb b/spec/ruby/core/array/pack/x_spec.rb index 2662873d03..a28dd0bf21 100644 --- a/spec/ruby/core/array/pack/x_spec.rb +++ b/spec/ruby/core/array/pack/x_spec.rb @@ -55,10 +55,10 @@ describe "Array#pack with format 'X'" do end it "raises an ArgumentError if the output string is empty" do - lambda { [1, 2, 3].pack("XC") }.should raise_error(ArgumentError) + -> { [1, 2, 3].pack("XC") }.should raise_error(ArgumentError) end it "raises an ArgumentError if the count modifier is greater than the bytes in the string" do - lambda { [1, 2, 3].pack("C2X3") }.should raise_error(ArgumentError) + -> { [1, 2, 3].pack("C2X3") }.should raise_error(ArgumentError) end end |