diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_econv.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index b1052dfc21..917b46c629 100644 --- a/test/ruby/test_econv.rb +++ b/test/ruby/test_econv.rb @@ -598,4 +598,19 @@ class TestEncodingConverter < Test::Unit::TestCase ec.convert("\xEF") assert_raise(Encoding::InvalidByteSequence) { ec.finish } end + + def test_last_error1 + ec = Encoding::Converter.new("sjis", "euc-jp") + assert_equal(nil, ec.last_error) + assert_equal(:incomplete_input, ec.primitive_convert(src="fo\x81", dst="", nil, nil)) + assert_kind_of(Encoding::InvalidByteSequence, ec.last_error) + end + + def test_last_error2 + ec = Encoding::Converter.new("sjis", "euc-jp") + assert_equal("fo", ec.convert(src="fo\x81")) + assert_raise(Encoding::InvalidByteSequence) { ec.finish } + assert_kind_of(Encoding::InvalidByteSequence, ec.last_error) + end + end |