summaryrefslogtreecommitdiffstats
path: root/test/iconv/test_basic.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-21 02:34:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-21 02:34:07 +0000
commit961101af6bfb7b9256a8183ce44804c476e5157a (patch)
tree5a3038d9186c106bc2e6cd1504872092f36e23cc /test/iconv/test_basic.rb
parent759211e2e28aeaf138b50caa1aa4570541091cb7 (diff)
downloadruby-961101af6bfb7b9256a8183ce44804c476e5157a.tar.gz
ruby-961101af6bfb7b9256a8183ce44804c476e5157a.tar.xz
ruby-961101af6bfb7b9256a8183ce44804c476e5157a.zip
* ext/iconv/iconv.c (strip_glibc_option, map_charset): check if
encoding is a string. based on the patch by Hiroshi Moriyama at [ruby-dev:36811]. * test/iconv/test_basic.rb (test_invalid_arguments): added tests. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/iconv/test_basic.rb')
-rw-r--r--test/iconv/test_basic.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/iconv/test_basic.rb b/test/iconv/test_basic.rb
index ea564e91f..394d271bc 100644
--- a/test/iconv/test_basic.rb
+++ b/test/iconv/test_basic.rb
@@ -43,6 +43,13 @@ class TestIconv::Basic < TestIconv
assert_equal("#{SJIS_STR}\n"*2, output)
end
+ def test_invalid_arguments
+ assert_raise(TypeError) { Iconv.new(nil, 'Shift_JIS') }
+ assert_raise(TypeError) { Iconv.new('Shift_JIS', nil) }
+ assert_raise(TypeError) { Iconv.open(nil, 'Shift_JIS') }
+ assert_raise(TypeError) { Iconv.open('Shift_JIS', nil) }
+ end
+
def test_unknown_encoding
assert_raise(Iconv::InvalidEncoding) { Iconv.iconv("utf-8", "X-UKNOWN", "heh") }
end