diff options
Diffstat (limited to 'spec/ruby/core/string/unpack/m_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/unpack/m_spec.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/ruby/core/string/unpack/m_spec.rb b/spec/ruby/core/string/unpack/m_spec.rb index 21134514a1..c1c1eea629 100644 --- a/spec/ruby/core/string/unpack/m_spec.rb +++ b/spec/ruby/core/string/unpack/m_spec.rb @@ -1,4 +1,4 @@ -# -*- encoding: binary -*- +# encoding: binary require_relative '../../../spec_helper' require_relative '../fixtures/classes' require_relative 'shared/basic' @@ -97,6 +97,11 @@ describe "String#unpack with format 'M'" do ["=FF=\n", ["\xff"]] ].should be_computed_by(:unpack, "M") end + + it "unpacks incomplete escape sequences as literal characters" do + "foo=".unpack("M").should == ["foo="] + "foo=4".unpack("M").should == ["foo=4"] + end end describe "String#unpack with format 'm'" do @@ -181,7 +186,7 @@ describe "String#unpack with format 'm'" do end it "raises an ArgumentError for an invalid base64 character" do - -> { "dGV%zdA==".unpack("m0") }.should raise_error(ArgumentError) + -> { "dGV%zdA==".unpack("m0") }.should.raise(ArgumentError) end end end |
