diff options
Diffstat (limited to 'spec/ruby/core/array/pack/shared/unicode.rb')
| -rw-r--r-- | spec/ruby/core/array/pack/shared/unicode.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/spec/ruby/core/array/pack/shared/unicode.rb b/spec/ruby/core/array/pack/shared/unicode.rb index e16110c491..4d8eaef323 100644 --- a/spec/ruby/core/array/pack/shared/unicode.rb +++ b/spec/ruby/core/array/pack/shared/unicode.rb @@ -64,11 +64,23 @@ 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 - [1, 2, 3].pack("U\x00U").should == "\x01\x02" + ruby_version_is ""..."3.3" do + it "ignores NULL bytes between directives" do + suppress_warning do + [1, 2, 3].pack("U\x00U").should == "\x01\x02" + end + end + end + + ruby_version_is "3.3" do + it "raise ArgumentError for NULL bytes between directives" do + -> { + [1, 2, 3].pack("U\x00U") + }.should raise_error(ArgumentError, /unknown pack directive/) + end end it "ignores spaces between directives" do @@ -76,11 +88,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 |
