From 23f0e341af6bca062b95fa9bc69b2fa59f903e05 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 24 Dec 2007 10:27:53 +0000 Subject: add tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io_m17n.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 1087d182ae..6bc9025f1a 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -48,7 +48,17 @@ EOT with_tmpdir { generate_file('tmp', "") open("tmp", "r") {|f| - assert_equal(nil, f.external_encoding) + assert_equal(Encoding.default_external, f.external_encoding) + assert_equal(nil, f.internal_encoding) + } + } + end + + def test_open_rb + with_tmpdir { + generate_file('tmp', "") + open("tmp", "rb") {|f| + assert_equal(Encoding::ASCII_8BIT, f.external_encoding) assert_equal(nil, f.internal_encoding) } } @@ -83,6 +93,15 @@ EOT } end + def test_open_wb + with_tmpdir { + open("tmp", "wb") {|f| + assert_equal(nil, f.external_encoding) + assert_equal(nil, f.internal_encoding) + } + } + end + def test_open_w_enc with_tmpdir { open("tmp", "w:euc-jp") {|f| -- cgit v1.2.3