mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
d324a46784
commit
6714f687e3
1 changed files with 16 additions and 0 deletions
|
@ -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 }
|
||||
|
|
Loading…
Add table
Reference in a new issue