diff options
Diffstat (limited to 'spec/ruby/core/string/unpack/h_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/unpack/h_spec.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/ruby/core/string/unpack/h_spec.rb b/spec/ruby/core/string/unpack/h_spec.rb index f2f5dcf396..0cf8d943a7 100644 --- a/spec/ruby/core/string/unpack/h_spec.rb +++ b/spec/ruby/core/string/unpack/h_spec.rb @@ -1,4 +1,4 @@ -# -*- encoding: binary -*- +# encoding: binary require_relative '../../../spec_helper' require_relative '../fixtures/classes' require_relative 'shared/basic' @@ -56,8 +56,10 @@ describe "String#unpack with format 'H'" do ].should be_computed_by(:unpack, "HHH") end - it "ignores NULL bytes between directives" do - "\x01\x10".unpack("H\x00H").should == ["0", "1"] + it "raise ArgumentError for NULL bytes between directives" do + -> { + "\x01\x10".unpack("H\x00H") + }.should.raise(ArgumentError, /unknown unpack directive/) end it "ignores spaces between directives" do @@ -121,8 +123,10 @@ describe "String#unpack with format 'h'" do ].should be_computed_by(:unpack, "hhh") end - it "ignores NULL bytes between directives" do - "\x01\x10".unpack("h\x00h").should == ["1", "0"] + it "raise ArgumentError for NULL bytes between directives" do + -> { + "\x01\x10".unpack("h\x00h") + }.should.raise(ArgumentError, /unknown unpack directive/) end it "ignores spaces between directives" do |
