diff --git a/test/test_basic.rb b/test/test_basic.rb index c6e2661..ba685fb 100644 --- a/test/test_basic.rb +++ b/test/test_basic.rb @@ -35,7 +35,7 @@ def test_open_without_block def test_open_with_block input = "#{EUCJ_STR}\n"*2 - output = "" + output = String.new Iconv.open("Shift_JIS", "EUC-JP") do |cd| input.each_line do |s| output << cd.iconv(s) diff --git a/test/test_option.rb b/test/test_option.rb index 4eea8ce..3680997 100644 --- a/test/test_option.rb +++ b/test/test_option.rb @@ -1,13 +1,21 @@ require File.expand_path("../utils.rb", __FILE__) class TestIconv::Option < TestIconv - def test_ignore_option + def setup begin iconv = Iconv.new('SHIFT_JIS', 'EUC-JP') iconv.transliterate? rescue NotImplementedError - return + omit "Iconv option is not implemented" end + @verbose, $VERBOSE = $VERBOSE, nil + end + + def teardown + $VERBOSE = @verbose + end + + def test_ignore_option iconv = Iconv.new('SHIFT_JIS', 'EUC-JP//ignore') str = iconv.iconv(EUCJ_STR) str << iconv.iconv(nil) @@ -22,12 +30,6 @@ def test_ignore_option end def test_translit_option - begin - iconv = Iconv.new('SHIFT_JIS', 'EUC-JP') - iconv.transliterate? - rescue NotImplementedError - return - end iconv = Iconv.new('SHIFT_JIS', 'EUC-JP//ignore') str = iconv.iconv(EUCJ_STR) str << iconv.iconv(nil) diff --git a/test/utils.rb b/test/utils.rb index 88c64c6..8eb9ff8 100644 --- a/test/utils.rb +++ b/test/utils.rb @@ -4,7 +4,7 @@ class TestIconv < ::Test::Unit::TestCase if defined?(::Encoding) and String.method_defined?(:force_encoding) def self.encode(str, enc) - str.force_encoding(enc) + str.dup.force_encoding(enc) end else def self.encode(str, enc)