diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-01 14:18:32 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-01 14:18:32 +0000 |
commit | 306f43acfef7959a9a41a13ce627b2493eb8993e (patch) | |
tree | 6f4622f4e7dcca09b6ac3ce4d9ddf34637202b22 /test | |
parent | b6e137e93c5fe62f3f6dc1a0112a6c067d456f9b (diff) |
String#unpack1 [Feature #12752]
Returns the first value of String#unpack.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_pack.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb index 8ecfbc0913..e9267fab1c 100644 --- a/test/ruby/test_pack.rb +++ b/test/ruby/test_pack.rb @@ -837,4 +837,11 @@ EXPECTED assert_equal addr, [buf].pack('p') end + + def test_unpack1 + assert_equal 65, "A".unpack1("C") + assert_equal 68, "ABCD".unpack1("x3C") + assert_equal 0x3042, "\u{3042 3044 3046}".unpack1("U*") + assert_equal "hogefuga", "aG9nZWZ1Z2E=".unpack1("m") + end end |