diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/csv/test_features.rb | 6 | ||||
-rw-r--r-- | test/csv/test_row.rb | 6 | ||||
-rw-r--r-- | test/csv/test_table.rb | 6 |
3 files changed, 12 insertions, 6 deletions
diff --git a/test/csv/test_features.rb b/test/csv/test_features.rb index 88e23d2f16..9ed3f98191 100644 --- a/test/csv/test_features.rb +++ b/test/csv/test_features.rb @@ -250,9 +250,11 @@ class TestCSVFeatures < Test::Unit::TestCase end end - def test_inspect_is_ascii_8bit_encoded + def test_inspect_encoding_is_ascii_compatible CSV.new("one,two,three\n1,2,3\n".encode("UTF-16BE")) do |csv| - assert_equal("ASCII-8BIT", csv.inspect.encoding.name) + assert( Encoding.compatible?( Encoding.find("US-ASCII"), + csv.inspect.encoding ), + "inspect() was not ASCII compatible." ) end end diff --git a/test/csv/test_row.rb b/test/csv/test_row.rb index bd0aad4104..d0b0cdc406 100644 --- a/test/csv/test_row.rb +++ b/test/csv/test_row.rb @@ -296,8 +296,10 @@ class TestCSVRow < Test::Unit::TestCase end end - def test_inspect_is_ascii_8bit_encoded - assert_equal("ASCII-8BIT", @row.inspect.encoding.name) + def test_inspect_encoding_is_ascii_compatible + assert( Encoding.compatible?( Encoding.find("US-ASCII"), + @row.inspect.encoding ), + "inspect() was not ASCII compatible." ) end def test_inspect_shows_symbol_headers_as_bare_attributes diff --git a/test/csv/test_table.rb b/test/csv/test_table.rb index 3c3cb1c155..d0b4d10103 100644 --- a/test/csv/test_table.rb +++ b/test/csv/test_table.rb @@ -400,7 +400,9 @@ class TestCSVTable < Test::Unit::TestCase assert(str.include?("mode:#{@table.mode}"), "Mode not shown.") end - def test_inspect_is_us_ascii_encoded - assert_equal("US-ASCII", @table.inspect.encoding.name) + def test_inspect_encoding_is_ascii_compatible + assert( Encoding.compatible?( Encoding.find("US-ASCII"), + @table.inspect.encoding ), + "inspect() was not ASCII compatible." ) end end |