mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* transcode.c (econv_finish): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
23d10cbb00
commit
2c80188627
3 changed files with 67 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue