diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-13 04:03:06 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-13 04:03:06 +0000 |
commit | db83618d2c49cbab8b78e31ecf5a8979895bc5d6 (patch) | |
tree | b7c0ac4231aaaec0b29b508556caeab5cca38c1b /test/ruby | |
parent | 272d72efc07c78d62d56cc10dbb30094083fb01f (diff) | |
download | ruby-db83618d2c49cbab8b78e31ecf5a8979895bc5d6.tar.gz |
* io.c (io_encoding_set): always warn if external encoding and internal
encoding are identical. [ruby-core:40727] [Bug #5568]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_io_m17n.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 4f01a82674..8c71c2c871 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -984,6 +984,32 @@ EOT end) end + def test_set_encoding_identical + bug5568 = '[ruby-core:40727]' + open(__FILE__, "r") do |f| + assert_warn(/Ignoring internal encoding euc-jp: it is identical to external encoding eucjp/, bug5568) { + f.set_encoding("eucjp:euc-jp") + } + assert_warn(/Ignoring internal encoding euc-jp: it is identical to external encoding eucjp/, bug5568) { + f.set_encoding("eucjp", "euc-jp") + } + assert_warn(/Ignoring internal encoding euc-jp: it is identical to external encoding EUC-JP/, bug5568) { + f.set_encoding(Encoding::EUC_JP, "euc-jp") + } + assert_warn(/Ignoring internal encoding EUC-JP: it is identical to external encoding eucjp/, bug5568) { + f.set_encoding("eucjp", Encoding::EUC_JP) + } + assert_warn(/Ignoring internal encoding EUC-JP: it is identical to external encoding EUC-JP/, bug5568) { + f.set_encoding(Encoding::EUC_JP, Encoding::EUC_JP) + } + nonstr = Object.new + def nonstr.to_str; "eucjp"; end + assert_warn(/Ignoring internal encoding eucjp: it is identical to external encoding eucjp/, bug5568) { + f.set_encoding(nonstr, nonstr) + } + end + end + def test_set_encoding_undef pipe(proc do |w| w << "\ufffd" |