summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/unpack/b_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/unpack/b_spec.rb')
-rw-r--r--spec/ruby/core/string/unpack/b_spec.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/spec/ruby/core/string/unpack/b_spec.rb b/spec/ruby/core/string/unpack/b_spec.rb
index 1a838d6c7c..fcabc99731 100644
--- a/spec/ruby/core/string/unpack/b_spec.rb
+++ b/spec/ruby/core/string/unpack/b_spec.rb
@@ -93,6 +93,11 @@ describe "String#unpack with format 'B'" do
it "ignores spaces between directives" do
"\x80\x00".unpack("B B").should == ["1", "0"]
end
+
+ it "decodes into US-ASCII string values" do
+ str = "s".force_encoding('UTF-8').unpack("B*")[0]
+ str.encoding.name.should == 'US-ASCII'
+ end
end
describe "String#unpack with format 'b'" do
@@ -189,5 +194,4 @@ describe "String#unpack with format 'b'" do
str = "s".force_encoding('UTF-8').unpack("b*")[0]
str.encoding.name.should == 'US-ASCII'
end
-
end