From 0fa1e1f5137021d0e7f25ccca034081b21a86b7f Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 13 Aug 2008 05:48:57 +0000 Subject: * 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: http://svn.ruby-lang.org/repos/ruby/trunk@18557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_econv.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index 8a09f1e9b..3b3241985 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 -- cgit