summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-pack/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-06-07 09:03:25 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-06-07 09:03:25 +0900
commit0afa651363c0b22f238c7442e84926e4e3f10574 (patch)
tree64c5ab2a87c452cc0b0b83c954eb22f1990cb8a2 /mrbgems/mruby-pack/test
parentbba044cfc8cbd8eb1d2da9db2298a80905e125bd (diff)
downloadmruby-0afa651363c0b22f238c7442e84926e4e3f10574.tar.gz
mruby-0afa651363c0b22f238c7442e84926e4e3f10574.zip
pack.c: support `M` specifier (quoted-printable).
Diffstat (limited to 'mrbgems/mruby-pack/test')
-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 93f5d8d46..56f63a3d7 100644
--- a/mrbgems/mruby-pack/test/pack.rb
+++ b/mrbgems/mruby-pack/test/pack.rb
@@ -28,6 +28,17 @@ assert('pack("m")') do
assert_pack "m0", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWg==", ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
end
+# pack & unpack 'M' (Quoted-printable)
+assert('pack("M")') do
+ assert_pack "M", "123=\n", ["123"]
+ assert_pack "M", "=3D\n", ["=\n"]
+ assert_pack "M", "=E3=81=82=\n", ["あ"]
+
+ assert_equal ["123"], "123=\n".unpack("M")
+ assert_equal ["=\n"], "=3D\n".unpack("M")
+ assert_equal ["あ"], "=E3=81=82=\n".unpack("M")
+end
+
# pack & unpack 'H'
assert('pack("H")') do
assert_pack "H*", "01", ["3031"]