From a6ec2584527fb4d6f3a65a2dd16dc02eabdfcec6 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 6 Nov 2012 00:50:02 +0000 Subject: * 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 --- test/ruby/test_m17n.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby') 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 -- cgit v1.2.3