summaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-04 12:08:54 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-04 12:08:54 +0000
commite00956b7ea013bcd2897e7a08b83fab4625327d9 (patch)
tree0bc7384efa6e1f02cfabd0a13c4b539c86a94d41 /test/ruby
parent177e91532e77daebcb407e54e28fb00a5a0f14c1 (diff)
downloadruby-e00956b7ea013bcd2897e7a08b83fab4625327d9.tar.gz
ruby-e00956b7ea013bcd2897e7a08b83fab4625327d9.tar.xz
ruby-e00956b7ea013bcd2897e7a08b83fab4625327d9.zip
* transcode.c (sym_universal_newline_decoder): new variable.
(sym_crlf_newline_encoder): ditto. (sym_cr_newline_encoder): ditto. (econv_opts): check newline converter options. (econv_init): make 3rd argument hash/nil only. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_econv.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb
index 12f652d85..e7256c12f 100644
--- a/test/ruby/test_econv.rb
+++ b/test/ruby/test_econv.rb
@@ -328,7 +328,7 @@ class TestEncodingConverter < Test::Unit::TestCase
end
def test_universal_newline
- ec = Encoding::Converter.new("UTF-8", "EUC-JP", Encoding::Converter::UNIVERSAL_NEWLINE_DECODER)
+ ec = Encoding::Converter.new("UTF-8", "EUC-JP", universal_newline_decoder: true)
a = ["", src="", ec, nil, 50, Encoding::Converter::PARTIAL_INPUT]
src << "abc\r\ndef"; check_ec("abc\ndef", "", :source_buffer_empty, *a)
src << "ghi\njkl"; check_ec("abc\ndefghi\njkl", "", :source_buffer_empty, *a)
@@ -339,7 +339,7 @@ class TestEncodingConverter < Test::Unit::TestCase
end
def test_universal_newline2
- ec = Encoding::Converter.new("", "", Encoding::Converter::UNIVERSAL_NEWLINE_DECODER)
+ ec = Encoding::Converter.new("", "", universal_newline_decoder: true)
a = ["", src="", ec, nil, 50, Encoding::Converter::PARTIAL_INPUT]
src << "abc\r\ndef"; check_ec("abc\ndef", "", :source_buffer_empty, *a)
src << "ghi\njkl"; check_ec("abc\ndefghi\njkl", "", :source_buffer_empty, *a)
@@ -350,22 +350,22 @@ class TestEncodingConverter < Test::Unit::TestCase
end
def test_crlf_newline
- ec = Encoding::Converter.new("UTF-8", "EUC-JP", Encoding::Converter::CRLF_NEWLINE_ENCODER)
+ ec = Encoding::Converter.new("UTF-8", "EUC-JP", crlf_newline_encoder: true)
assert_econv("abc\r\ndef", :finished, 50, ec, "abc\ndef", "")
end
def test_crlf_newline2
- ec = Encoding::Converter.new("", "", Encoding::Converter::CRLF_NEWLINE_ENCODER)
+ ec = Encoding::Converter.new("", "", crlf_newline_encoder: true)
assert_econv("abc\r\ndef", :finished, 50, ec, "abc\ndef", "")
end
def test_cr_newline
- ec = Encoding::Converter.new("UTF-8", "EUC-JP", Encoding::Converter::CR_NEWLINE_ENCODER)
+ ec = Encoding::Converter.new("UTF-8", "EUC-JP", cr_newline_encoder: true)
assert_econv("abc\rdef", :finished, 50, ec, "abc\ndef", "")
end
def test_cr_newline2
- ec = Encoding::Converter.new("", "", Encoding::Converter::CR_NEWLINE_ENCODER)
+ ec = Encoding::Converter.new("", "", cr_newline_encoder: true)
assert_econv("abc\rdef", :finished, 50, ec, "abc\ndef", "")
end
@@ -516,7 +516,7 @@ class TestEncodingConverter < Test::Unit::TestCase
end
def test_invalid_replace
- ec = Encoding::Converter.new("UTF-8", "EUC-JP", Encoding::Converter::INVALID_REPLACE)
+ ec = Encoding::Converter.new("UTF-8", "EUC-JP", invalid: :replace)
ret = ec.primitive_convert(src="abc\x80def", dst="", nil, 100)
assert_equal(:finished, ret)
assert_equal("", src)
@@ -532,7 +532,7 @@ class TestEncodingConverter < Test::Unit::TestCase
end
def test_undef_replace
- ec = Encoding::Converter.new("UTF-8", "EUC-JP", Encoding::Converter::UNDEF_REPLACE)
+ ec = Encoding::Converter.new("UTF-8", "EUC-JP", :undef => :replace)
ret = ec.primitive_convert(src="abc\u{fffd}def", dst="", nil, 100)
assert_equal(:finished, ret)
assert_equal("", src)
@@ -650,7 +650,7 @@ class TestEncodingConverter < Test::Unit::TestCase
end
def test_set_replacement
- ec = Encoding::Converter.new("utf-8", "us-ascii", Encoding::Converter::UNDEF_REPLACE)
+ ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace)
ec.replacement = "<undef>"
assert_equal("a <undef> b", ec.convert("a \u3042 b"))
end