diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-07-14 18:59:41 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-07-14 18:59:41 +0900 |
| commit | 38624074e9ae057f8daaceeafcbcd43e10f203d3 (patch) | |
| tree | 1b4152a5fa21d8602a9028963c5701bb0bc3bb8a /mrbgems/mruby-pack/test/pack.rb | |
| parent | a7be9f1cab2e9b09995bb388e1219784920610e7 (diff) | |
| parent | fd899481643feeed874c95060fa50cb75f9d993a (diff) | |
| download | mruby-38624074e9ae057f8daaceeafcbcd43e10f203d3.tar.gz mruby-38624074e9ae057f8daaceeafcbcd43e10f203d3.zip | |
Merge pull request #4577 from dearblue/pack-unpack
Fix pack/unpack for base64; ref #4556
Diffstat (limited to 'mrbgems/mruby-pack/test/pack.rb')
| -rw-r--r-- | mrbgems/mruby-pack/test/pack.rb | 11 |
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"] |
