aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-28 18:00:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-28 18:00:02 +0000
commit2c80188627712523cb29b17fe435bf50a613fd4e (patch)
tree2bca4128b30245fc7b51793e3fee75ab137a0223 /test
parent23d10cbb00c726571183ad96dcd26547fd6200d8 (diff)
downloadruby-2c80188627712523cb29b17fe435bf50a613fd4e.tar.gz
* transcode.c (econv_finish): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_econv.rb13
1 files changed, 13 insertions, 0 deletions
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