summaryrefslogtreecommitdiff
path: root/spec/ruby/core/array/pack/x_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/array/pack/x_spec.rb')
-rw-r--r--spec/ruby/core/array/pack/x_spec.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/spec/ruby/core/array/pack/x_spec.rb b/spec/ruby/core/array/pack/x_spec.rb
index 8d54ab84ee..012fe4567f 100644
--- a/spec/ruby/core/array/pack/x_spec.rb
+++ b/spec/ruby/core/array/pack/x_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 "Array#pack with format 'x'" do
it_behaves_like :array_pack_basic, 'x'
@@ -30,6 +30,7 @@ describe "Array#pack with format 'x'" do
it "does not add a NULL byte when passed the '*' modifier" do
[].pack("x*").should == ""
+ [1, 2].pack("Cx*C").should == "\x01\x02"
end
end
@@ -55,10 +56,10 @@ describe "Array#pack with format 'X'" do
end
it "raises an ArgumentError if the output string is empty" do
- lambda { [1, 2, 3].pack("XC") }.should raise_error(ArgumentError)
+ -> { [1, 2, 3].pack("XC") }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if the count modifier is greater than the bytes in the string" do
- lambda { [1, 2, 3].pack("C2X3") }.should raise_error(ArgumentError)
+ -> { [1, 2, 3].pack("C2X3") }.should raise_error(ArgumentError)
end
end