diff options
Diffstat (limited to 'spec/ruby/core/string/unpack/b_spec.rb')
-rw-r--r-- | spec/ruby/core/string/unpack/b_spec.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/ruby/core/string/unpack/b_spec.rb b/spec/ruby/core/string/unpack/b_spec.rb index 2cf5ebad34..23d93a8aea 100644 --- a/spec/ruby/core/string/unpack/b_spec.rb +++ b/spec/ruby/core/string/unpack/b_spec.rb @@ -88,7 +88,9 @@ describe "String#unpack with format 'B'" do ruby_version_is ""..."3.3" do it "ignores NULL bytes between directives" do - "\x80\x00".unpack("B\x00B").should == ["1", "0"] + suppress_warning do + "\x80\x00".unpack("B\x00B").should == ["1", "0"] + end end end @@ -105,7 +107,7 @@ describe "String#unpack with format 'B'" do end it "decodes into US-ASCII string values" do - str = "s".force_encoding('UTF-8').unpack("B*")[0] + str = "s".dup.force_encoding('UTF-8').unpack("B*")[0] str.encoding.name.should == 'US-ASCII' end end @@ -194,7 +196,9 @@ describe "String#unpack with format 'b'" do ruby_version_is ""..."3.3" do it "ignores NULL bytes between directives" do - "\x01\x00".unpack("b\x00b").should == ["1", "0"] + suppress_warning do + "\x01\x00".unpack("b\x00b").should == ["1", "0"] + end end end @@ -211,7 +215,7 @@ describe "String#unpack with format 'b'" do end it "decodes into US-ASCII string values" do - str = "s".force_encoding('UTF-8').unpack("b*")[0] + str = "s".dup.force_encoding('UTF-8').unpack("b*")[0] str.encoding.name.should == 'US-ASCII' end end |