diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-06 00:50:02 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-06 00:50:02 +0000 |
commit | a6ec2584527fb4d6f3a65a2dd16dc02eabdfcec6 (patch) | |
tree | dc7946982b288377e7decba6107feed262613bbc /test | |
parent | 58ef0f06c6f6fcc4f6a0d31ade430d87ef9d968d (diff) | |
download | ruby-a6ec2584527fb4d6f3a65a2dd16dc02eabdfcec6.tar.gz |
* string.c (rb_str_b): Add String#b, returning a copied string
whose encoding is ASCII-8BIT. [ruby-dev:45992] [Feature #6767]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_m17n.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 7e343ab31f..bdde127840 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1471,4 +1471,14 @@ class TestM17N < Test::Unit::TestCase yield(*strs) end end + + def test_str_b + s = "\u3042" + assert_equal(a("\xE3\x81\x82"), s.b) + assert_equal(Encoding::ASCII_8BIT, s.b.encoding) + s.taint + assert_equal(true, s.b.tainted?) + s.untrust + assert_equal(true, s.b.untrusted?) + end end |