Skip to content

Commit

Permalink
Merge pull request #970 from seven1m/string-unpack-b
Browse files Browse the repository at this point in the history
Add encoding spec for String#unpack 'B' directive
  • Loading branch information
andrykonchin authored Oct 27, 2022
2 parents d1c6f4d + 55b3e53 commit 67a9d1e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/string/unpack/b_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@
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
Expand Down Expand Up @@ -189,5 +194,4 @@
str = "s".force_encoding('UTF-8').unpack("b*")[0]
str.encoding.name.should == 'US-ASCII'
end

end

0 comments on commit 67a9d1e

Please sign in to comment.