summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authordearblue <[email protected]>2019-07-15 10:41:32 +0900
committerdearblue <[email protected]>2019-07-15 10:41:32 +0900
commit109d926e9ca2e1efc974b45b1ca25095a57c709d (patch)
tree684a3955d02ce6fcda9e076f560d1a70d3c755a9
parenta7be9f1cab2e9b09995bb388e1219784920610e7 (diff)
downloadmruby-109d926e9ca2e1efc974b45b1ca25095a57c709d.tar.gz
mruby-109d926e9ca2e1efc974b45b1ca25095a57c709d.zip
Add pack/unpack test for base64
-rw-r--r--mrbgems/mruby-pack/test/pack.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/mrbgems/mruby-pack/test/pack.rb b/mrbgems/mruby-pack/test/pack.rb
index eb24e8d1f..68ef4165f 100644
--- a/mrbgems/mruby-pack/test/pack.rb
+++ b/mrbgems/mruby-pack/test/pack.rb
@@ -35,6 +35,17 @@ assert('"YWJ...".unpack("m") should "abc..xyzABC..XYZ"') do
assert_equal ary, "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWg==\n".unpack("m")
end
+assert('["A", "B"].pack') do
+ assert_equal "QQ==\n", ["A", "B"].pack("m50")
+ assert_equal ["A"], "QQ==\n".unpack("m50")
+ assert_equal "QQ==Qg==", ["A", "B"].pack("m0 m0")
+ assert_equal ["A", "B"], "QQ==Qg==".unpack("m10 m10")
+end
+
+assert('["abc..xyzABC..XYZ"].pack("m0")') do
+ assert_pack "m0", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWg==", ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
+end
+
# pack & unpack 'H'
assert('["3031"].pack("H*")') do
assert_pack "H*", "01", ["3031"]