Skip to content

Commit

Permalink
adding test for file open encoding bug reported at JRUBY-6572
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Plentz committed Apr 22, 2012
1 parent 0d1759c commit 9920a7e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions file_open_test.rb
@@ -0,0 +1,20 @@
require 'rubygems'
require 'minitest/autorun'

class FileOpenTest < MiniTest::Unit::TestCase

#works on both
def test_file_open_line_encoding_when_default_encoding_is_nil
Encoding.default_internal = nil
File.open('zh_cn-utf8.txt', 'rb') do |file|
assert_equal file.gets.encoding, Encoding::ASCII_8BIT
end
end

def test_file_open_line_encoding_when_default_encoding_is_utf8
Encoding.default_internal = 'utf-8'
File.open('zh_cn-utf8.txt', 'rb') do |file|
assert_equal file.gets.encoding, Encoding::ASCII_8BIT
end
end
end
1 change: 1 addition & 0 deletions zh_cn-utf8.txt
@@ -0,0 +1 @@

0 comments on commit 9920a7e

Please sign in to comment.