From 2c80188627712523cb29b17fe435bf50a613fd4e Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 28 Aug 2008 18:00:02 +0000 Subject: * transcode.c (econv_finish): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_econv.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index 8f29fb9f31..0e091f45cb 100644 --- a/test/ruby/test_econv.rb +++ b/test/ruby/test_econv.rb @@ -568,4 +568,17 @@ class TestEncodingConverter < Test::Unit::TestCase assert_equal(:finished, ret) assert_raise(ArgumentError) { ec.convert("a") } end + + def test_finish_iso2022jp + ec = Encoding::Converter.new("utf-8", "iso-2022-jp") + assert_equal("\e$B$\"".force_encoding("iso-2022-jp"), ec.convert("\u3042")) + assert_equal("\e(B".force_encoding("iso-2022-jp"), ec.finish) + + end + + def test_finish_incomplete_error + ec = Encoding::Converter.new("utf-8", "euc-jp") + ec.convert("\xEF") + assert_raise(Encoding::InvalidByteSequence) { ec.finish } + end end -- cgit v1.2.3