From daa622aed079b4434e607820d7577b4a7d4f2bfc Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 29 Feb 2008 09:19:15 +0000 Subject: * time.c (time_strftime): format should be ascii compatible. * parse.y (rb_intern3): non ASCII compatible symbols. * re.c (rb_reg_regsub): add encoding check. * string.c (rb_str_chomp_bang): ditto. * test/ruby/test_utf16.rb (TestUTF16::test_chomp): raises exception. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_utf16.rb | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_utf16.rb b/test/ruby/test_utf16.rb index bd56377734..1647563f84 100644 --- a/test/ruby/test_utf16.rb +++ b/test/ruby/test_utf16.rb @@ -132,13 +132,21 @@ EOT end def test_hex - s1 = "f\0f\0".force_encoding("utf-16le") - assert_equal(255, s1.hex, "#{encdump s1}.hex") + assert_raise(ArgumentError) { + "ff".encode("utf-16le").hex + } + assert_raise(ArgumentError) { + "ff".encode("utf-16be").hex + } end def test_oct - assert_equal(077, "77".encode("utf-16le").oct) - assert_equal(077, "77".encode("utf-16be").oct) + assert_raise(ArgumentError) { + "77".encode("utf-16le").oct + } + assert_raise(ArgumentError) { + "77".encode("utf-16be").oct + } end def test_count @@ -224,7 +232,9 @@ EOT def test_chomp s = "\1\n".force_encoding("utf-16be") - assert_str_equal(s, s.chomp, "#{encdump s}.chomp") + assert_raise(ArgumentError, "#{encdump s}.chomp") { + s.chomp + } end def test_succ -- cgit v1.2.3