diff options
-rw-r--r-- | bootstraptest/test_knownbug.rb | 8 | ||||
-rw-r--r-- | test/ruby/test_io_m17n.rb | 22 |
2 files changed, 22 insertions, 8 deletions
diff --git a/bootstraptest/test_knownbug.rb b/bootstraptest/test_knownbug.rb index c0cd0e9f31..7918031321 100644 --- a/bootstraptest/test_knownbug.rb +++ b/bootstraptest/test_knownbug.rb @@ -4,14 +4,6 @@ # assert_equal 'ok', %q{ - open("tmp", "w") {|f| f.write "a\u00FFb" } - s = open("tmp", "r:iso-8859-1:utf-8") {|f| - f.gets("\xFF".force_encoding("iso-8859-1")) - } - s == "a\xFF" ? :ok : :ng -}, '[ruby-core:14288]' - -assert_equal 'ok', %q{ open("require-lock-test.rb", "w") {|f| f.puts "sleep 0.1" f.puts "module M" diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb new file mode 100644 index 0000000000..43f3c3ce01 --- /dev/null +++ b/test/ruby/test_io_m17n.rb @@ -0,0 +1,22 @@ +require 'test/unit' +require 'tmpdir' + +class TestIOM17N < Test::Unit::TestCase + def with_tmpdir + Dir.mktmpdir {|dir| + Dir.chdir dir + yield dir + } + end + + def test_conversion + with_tmpdir { + open("tmp", "w") {|f| f.write "before \u00FF after" } + s = open("tmp", "r:iso-8859-1:utf-8") {|f| + f.gets("\xFF".force_encoding("iso-8859-1")) + } + assert_equal("before \xFF".force_encoding("iso-8859-1"), s, '[ruby-core:14288]') + } + end +end + |