mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_io.rb: duplicated test
* test/ruby/test_io.rb (test_s_write): merge duplicated test. * test/ruby/test_io.rb (test_io_s_write): remove duplicated assertsions git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0e04af5263
commit
9947024242
1 changed files with 3 additions and 19 deletions
|
@ -2566,6 +2566,9 @@ End
|
||||||
assert_equal("\00f", File.read(path))
|
assert_equal("\00f", File.read(path))
|
||||||
assert_equal(1, File.write(path, "f", 0, encoding: "UTF-8"))
|
assert_equal(1, File.write(path, "f", 0, encoding: "UTF-8"))
|
||||||
assert_equal("ff", File.read(path))
|
assert_equal("ff", File.read(path))
|
||||||
|
assert_raise(TypeError) {
|
||||||
|
File.write(path, "foo", Object.new => Object.new)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2968,23 +2971,4 @@ End
|
||||||
ensure
|
ensure
|
||||||
t.kill
|
t.kill
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_io_s_write
|
|
||||||
t = Tempfile.new("test_io")
|
|
||||||
t.close
|
|
||||||
path = t.path
|
|
||||||
File.unlink(path)
|
|
||||||
IO.write(path, "foo")
|
|
||||||
assert_equal("foo", IO.read(path))
|
|
||||||
IO.write(path, "bar", 2)
|
|
||||||
assert_equal("fobar", IO.read(path))
|
|
||||||
File.unlink(path)
|
|
||||||
IO.write(path, "foo", encoding: Encoding::UTF_32BE)
|
|
||||||
assert_equal("\0\0\0f\0\0\0o\0\0\0o", File.binread(path))
|
|
||||||
assert_raise(TypeError) {
|
|
||||||
IO.write(path, "foo", Object.new => Object.new)
|
|
||||||
}
|
|
||||||
ensure
|
|
||||||
t.close!
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue