diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-15 00:05:06 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-15 00:05:06 +0000 |
commit | 520cd6d186fd0753e052fd153fc2c5b764cb9aee (patch) | |
tree | b6bff4e98745c435ac57140cab7b930efd5f045c /test | |
parent | 51c7947bdeac3bb9e80dfd104ab3352fb57ce1b0 (diff) | |
download | ruby-520cd6d186fd0753e052fd153fc2c5b764cb9aee.tar.gz |
* transcode.c (econv_init): don't create dummy encoding if
rb_econv_open is failed.
(make_dummy_encoding): new function extracted from make_encoding.
(make_encoding): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_econv.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index af846ad45b..738be01e8c 100644 --- a/test/ruby/test_econv.rb +++ b/test/ruby/test_econv.rb @@ -25,6 +25,19 @@ class TestEncodingConverter < Test::Unit::TestCase assert_kind_of(Encoding::Converter, Encoding::Converter.new(Encoding::UTF_8, Encoding::EUC_JP)) end + def test_new_fail + name1 = "encoding-which-is-not-exist-1" + name2 = "encoding-which-is-not-exist-2" + + assert_raise(ArgumentError) { + Encoding::Converter.new(name1, name2) + } + + encoding_list = Encoding.list.map {|e| e.name } + assert(!encoding_list.include?(name1)) + assert(!encoding_list.include?(name2)) + end + def test_get_encoding ec = Encoding::Converter.new("UTF-8", "EUC-JP") assert_equal(Encoding::UTF_8, ec.source_encoding) |