summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/unpack/m_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/unpack/m_spec.rb')
-rw-r--r--spec/ruby/core/string/unpack/m_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/string/unpack/m_spec.rb b/spec/ruby/core/string/unpack/m_spec.rb
index 96841f24cb..21134514a1 100644
--- a/spec/ruby/core/string/unpack/m_spec.rb
+++ b/spec/ruby/core/string/unpack/m_spec.rb
@@ -170,4 +170,18 @@ describe "String#unpack with format 'm'" do
"".unpack("m").first.encoding.should == Encoding::BINARY
"Ojs8PT4/QA==\n".unpack("m").first.encoding.should == Encoding::BINARY
end
+
+ it "does not raise an error for an invalid base64 character" do
+ "dGV%zdA==".unpack("m").should == ["test"]
+ end
+
+ describe "when given count 0" do
+ it "decodes base64" do
+ "dGVzdA==".unpack("m0").should == ["test"]
+ end
+
+ it "raises an ArgumentError for an invalid base64 character" do
+ -> { "dGV%zdA==".unpack("m0") }.should raise_error(ArgumentError)
+ end
+ end
end