Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding test for file open encoding bug reported at JRUBY-6572
- Loading branch information
Diego Plentz
committed
Apr 22, 2012
1 parent
0d1759c
commit 9920a7e
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
中 |