aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_io_m17n.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-23 02:23:42 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-23 02:23:42 +0000
commit860c2331039537c4d0c5c8c92ae1e89395f0edcc (patch)
tree46aca87ad648da3ee8f5caf5a433c0e3193f74fc /test/ruby/test_io_m17n.rb
parent3721df734c9ad1be0bbd64321329c1af405b289b (diff)
downloadruby-860c2331039537c4d0c5c8c92ae1e89395f0edcc.tar.gz
* io.c (rb_io_extract_modeenc): check :textmode and :binmode in option
hash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r--test/ruby/test_io_m17n.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 9fb3c63e2a..59a691cbd6 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -979,11 +979,18 @@ EOT
}
end
+ def test_both_textmode_binmode
+ assert_raise(ArgumentError) { open("not-exist", "r", :textmode=>true, :binmode=>true) }
+ end
+
def test_textmode_decode_universal_newline_read
with_tmpdir {
generate_file("t.crlf", "a\r\nb\r\nc\r\n")
assert_equal("a\nb\nc\n", File.read("t.crlf", mode:"rt:euc-jp:utf-8"))
assert_equal("a\nb\nc\n", File.read("t.crlf", mode:"rt"))
+ open("t.crlf", "rt:euc-jp:utf-8") {|f| assert_equal("a\nb\nc\n", f.read) }
+ open("t.crlf", "rt") {|f| assert_equal("a\nb\nc\n", f.read) }
+ open("t.crlf", "r", :textmode=>true) {|f| assert_equal("a\nb\nc\n", f.read) }
generate_file("t.cr", "a\rb\rc\r")
assert_equal("a\nb\nc\n", File.read("t.cr", mode:"rt:euc-jp:utf-8"))
@@ -1105,6 +1112,9 @@ EOT
open("t.txt", "rb") {|f|
assert_equal(src, f.read)
}
+ open("t.txt", "r", :binmode=>true) {|f|
+ assert_equal(src, f.read)
+ }
if File::BINARY == 0
open("t.txt", "r") {|f|
assert_equal(src, f.read)