diff options
Diffstat (limited to 'spec/ruby/core/string/unpack/c_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/unpack/c_spec.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/ruby/core/string/unpack/c_spec.rb b/spec/ruby/core/string/unpack/c_spec.rb index 36de462cac..d881015b5e 100644 --- a/spec/ruby/core/string/unpack/c_spec.rb +++ b/spec/ruby/core/string/unpack/c_spec.rb @@ -1,7 +1,7 @@ -# -*- encoding: ascii-8bit -*- -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../../fixtures/classes', __FILE__) -require File.expand_path('../shared/basic', __FILE__) +# encoding: binary +require_relative '../../../spec_helper' +require_relative '../fixtures/classes' +require_relative 'shared/basic' describe :string_unpack_8bit, shared: true do it "decodes one byte for a single format character" do @@ -20,7 +20,7 @@ describe :string_unpack_8bit, shared: true do "abc".unpack(unpack_format('*')).should == [97, 98, 99] end - it "decodes the remaining bytes when passed the '*' modifer after another directive" do + it "decodes the remaining bytes when passed the '*' modifier after another directive" do "abc".unpack(unpack_format()+unpack_format('*')).should == [97, 98, 99] end @@ -35,8 +35,10 @@ describe :string_unpack_8bit, shared: true do ].should be_computed_by(:unpack, unpack_format(3)) end - it "ignores NULL bytes between directives" do - "abc".unpack(unpack_format("\000", 2)).should == [97, 98] + it "raise ArgumentError for NULL bytes between directives" do + -> { + "abc".unpack(unpack_format("\000", 2)) + }.should.raise(ArgumentError, /unknown unpack directive/) end it "ignores spaces between directives" do |
