summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/unpack/h_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/unpack/h_spec.rb')
-rw-r--r--spec/ruby/core/string/unpack/h_spec.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/ruby/core/string/unpack/h_spec.rb b/spec/ruby/core/string/unpack/h_spec.rb
index 07d52149d1..f2f5dcf396 100644
--- a/spec/ruby/core/string/unpack/h_spec.rb
+++ b/spec/ruby/core/string/unpack/h_spec.rb
@@ -1,4 +1,4 @@
-# -*- encoding: ascii-8bit -*-
+# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'
@@ -63,6 +63,10 @@ describe "String#unpack with format 'H'" do
it "ignores spaces between directives" do
"\x01\x10".unpack("H H").should == ["0", "1"]
end
+
+ it "should make strings with US_ASCII encoding" do
+ "\x01".unpack("H")[0].encoding.should == Encoding::US_ASCII
+ end
end
describe "String#unpack with format 'h'" do
@@ -124,4 +128,8 @@ describe "String#unpack with format 'h'" do
it "ignores spaces between directives" do
"\x01\x10".unpack("h h").should == ["1", "0"]
end
+
+ it "should make strings with US_ASCII encoding" do
+ "\x01".unpack("h")[0].encoding.should == Encoding::US_ASCII
+ end
end