diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-13 05:48:57 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-13 05:48:57 +0000 |
commit | a14d5eb09bc791b7ada7897a8fdb6a243babbb78 (patch) | |
tree | b342f2f72bb763982d4d89001d4e8dd1d368de03 /test/ruby/test_econv.rb | |
parent | 74a2a7bdbfbf70febab024354fe0b7fb26300704 (diff) | |
download | ruby-a14d5eb09bc791b7ada7897a8fdb6a243babbb78.tar.gz |
* enc/trans/newline.trans (rb_crlf_newline): new transcoder.
(rb_cr_newline): new transcoder.
* transcode.c (trans_open_i): one more exra room for input newline
converter.
(rb_trans_open): crlf newline and cr newline implemented.
(Init_transcode): Encoding::Converter::CRLF_NEWLINE and
Encoding::Converter::LF_NEWLINE defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_econv.rb')
-rw-r--r-- | test/ruby/test_econv.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index 8a09f1e9bb..3b32419859 100644 --- a/test/ruby/test_econv.rb +++ b/test/ruby/test_econv.rb @@ -64,4 +64,16 @@ class TestEncodingConverter < Test::Unit::TestCase ret = ec.primitive_convert(src="\nvwx", dst="", 50, Encoding::Converter::PARTIAL_INPUT) assert_equal([:ibuf_empty, "", "vwx"], [ret, src, dst]) end + + def test_crlf_newline + ec = Encoding::Converter.new("UTF-8", "EUC-JP", Encoding::Converter::CRLF_NEWLINE) + ret = ec.primitive_convert(src="abc\ndef", dst="", 50, 0) + assert_equal([:finished, "", "abc\r\ndef"], [ret, src, dst]) + end + + def test_cr_newline + ec = Encoding::Converter.new("UTF-8", "EUC-JP", Encoding::Converter::CR_NEWLINE) + ret = ec.primitive_convert(src="abc\ndef", dst="", 50, 0) + assert_equal([:finished, "", "abc\rdef"], [ret, src, dst]) + end end |