2009-10-15 01:21:00 -04:00
|
|
|
require File.expand_path("../utils.rb", __FILE__)
|
2008-06-05 00:58:41 -04:00
|
|
|
|
2008-06-06 05:25:46 -04:00
|
|
|
class TestIconv::Option < TestIconv
|
2008-06-05 00:58:41 -04:00
|
|
|
def test_ignore_option
|
2008-08-20 19:00:01 -04:00
|
|
|
begin
|
|
|
|
iconv = Iconv.new('SHIFT_JIS', 'EUC-JP')
|
|
|
|
iconv.transliterate?
|
|
|
|
rescue NotImplementedError
|
|
|
|
return
|
|
|
|
end
|
2008-06-05 00:58:41 -04:00
|
|
|
iconv = Iconv.new('SHIFT_JIS', 'EUC-JP//ignore')
|
|
|
|
str = iconv.iconv(EUCJ_STR)
|
|
|
|
str << iconv.iconv(nil)
|
|
|
|
assert_equal(SJIS_STR, str)
|
|
|
|
iconv.close
|
|
|
|
|
|
|
|
iconv = Iconv.new('SHIFT_JIS//IGNORE', 'EUC-JP//ignore')
|
|
|
|
str = iconv.iconv(EUCJ_STR)
|
|
|
|
str << iconv.iconv(nil)
|
|
|
|
assert_equal(SJIS_STR, str)
|
|
|
|
iconv.close
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_translit_option
|
2008-08-20 19:00:01 -04:00
|
|
|
begin
|
|
|
|
iconv = Iconv.new('SHIFT_JIS', 'EUC-JP')
|
|
|
|
iconv.transliterate?
|
|
|
|
rescue NotImplementedError
|
|
|
|
return
|
|
|
|
end
|
2008-06-05 00:58:41 -04:00
|
|
|
iconv = Iconv.new('SHIFT_JIS', 'EUC-JP//ignore')
|
|
|
|
str = iconv.iconv(EUCJ_STR)
|
|
|
|
str << iconv.iconv(nil)
|
|
|
|
assert_equal(SJIS_STR, str)
|
|
|
|
iconv.close
|
|
|
|
|
|
|
|
iconv = Iconv.new('SHIFT_JIS//TRANSLIT', 'EUC-JP//translit//ignore')
|
|
|
|
str = iconv.iconv(EUCJ_STR)
|
|
|
|
str << iconv.iconv(nil)
|
|
|
|
assert_equal(SJIS_STR, str)
|
|
|
|
iconv.close
|
|
|
|
end
|
2009-10-15 01:17:06 -04:00
|
|
|
end if false and defined?(TestIconv)
|