diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-28 03:52:43 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-28 03:52:43 +0000 |
commit | 6714f687e392d70afb2b4ab5e0a70fc50324ca56 (patch) | |
tree | be5efd3850e86c0f5b5c6d2966571ddb2dbefa7c /test | |
parent | d324a4678404ac80e5bf87f143faa59c5b05a874 (diff) | |
download | ruby-6714f687e392d70afb2b4ab5e0a70fc50324ca56.tar.gz |
* test/ruby/test_file.rb (test_each_char_extended_file,
test_getbyte_extended_file): add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_file.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index f6fcf89a14..64f6727413 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -85,6 +85,15 @@ class TestFile < Test::Unit::TestCase assert_equal("a", f.gets("")) end + def test_each_char_extended_file + f = Tempfile.new("test-extended-file") + assert_nil(f.getc) + open(f.path, "w") {|g| g.print "a" } + result = [] + f.each_char {|b| result << b } + assert_equal([?a], result) + end + def test_each_byte_extended_file f = Tempfile.new("test-extended-file") assert_nil(f.getc) @@ -101,6 +110,13 @@ class TestFile < Test::Unit::TestCase assert_equal(?a, f.getc) end + def test_getbyte_extended_file + f = Tempfile.new("test-extended-file") + assert_nil(f.getc) + open(f.path, "w") {|g| g.print "a" } + assert_equal(?a, f.getbyte.chr) + end + def test_s_chown assert_nothing_raised { File.chown -1, -1 } assert_nothing_raised { File.chown nil, nil } |