summaryrefslogtreecommitdiff
path: root/test/ruby/test_io_m17n.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-23 07:56:25 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-23 07:56:25 +0000
commitaa5b65b2edf4e79f09b6e9dd488bf160b6a39260 (patch)
tree25fcdc057d9bdced3e0d999754e2cd17a1f40a1d /test/ruby/test_io_m17n.rb
parente7d83904cb0698d304fb8631ca34d4434152fd17 (diff)
* io.c (extract_binmode): raise an exception if binmode/textmode
is specified with both vmode and opthash. [ruby-core:42199] [Bug #5918] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r--test/ruby/test_io_m17n.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 24a11643cd..f1a736735c 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -1047,6 +1047,29 @@ EOT
f.set_encoding("iso-2022-jp")
}
}
+ assert_raise(ArgumentError) {
+ open(__FILE__, "rb", binmode: true) {|f|
+ f.set_encoding("iso-2022-jp")
+ }
+ }
+ assert_raise(ArgumentError) {
+ open(__FILE__, "rb", binmode: false) {|f|
+ f.set_encoding("iso-2022-jp")
+ }
+ }
+ end
+
+ def test_textmode_twice
+ assert_raise(ArgumentError) {
+ open(__FILE__, "rt", textmode: true) {|f|
+ f.set_encoding("iso-2022-jp")
+ }
+ }
+ assert_raise(ArgumentError) {
+ open(__FILE__, "rt", textmode: false) {|f|
+ f.set_encoding("iso-2022-jp")
+ }
+ }
end
def test_write_conversion_fixenc
@@ -1344,6 +1367,8 @@ EOT
def test_both_textmode_binmode
assert_raise(ArgumentError) { open("not-exist", "r", :textmode=>true, :binmode=>true) }
+ assert_raise(ArgumentError) { open("not-exist", "rt", :binmode=>true) }
+ assert_raise(ArgumentError) { open("not-exist", "rb", :textmode=>true) }
end
def test_textmode_decode_universal_newline_read