From 2e7815dd8000dc4d3ef7f2443bf5fd045812ee9e Mon Sep 17 00:00:00 2001 From: duerst Date: Sun, 16 Mar 2008 09:09:53 +0000 Subject: Sun Mar 16 18:07:07 2008 Martin Duerst * enc/trans/utf_16_32.c: bug fix (some invalid UTF-8 sequences were legal) * test/ruby/test_transcode.rb: test for above bug git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_transcode.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test/ruby/test_transcode.rb') diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index 5a704fd364..e4bad8e38a 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -3,7 +3,7 @@ require 'test/unit' class TestTranscode < Test::Unit::TestCase - def setup # trick to create all the necessary encodings + def setup_really_needed? # trick to create all the necessary encodings all_encodings = [ 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', @@ -248,5 +248,9 @@ class TestTranscode < Test::Unit::TestCase "\x41\xC2\x3E\x42".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) assert_equal("\x00\x41\x00\xF1\x00\x42".force_encoding('UTF-16BE'), "\x41\xC2\xC3\xB1\x42".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) + assert_equal("\x00\x42".force_encoding('UTF-16BE'), + "\xF0\x80\x80\x42".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) + assert_equal(''.force_encoding('UTF-16BE'), + "\x82\xAB".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) end end -- cgit v1.2.3