1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Prefer more descriptive assertion methods

This commit is contained in:
Nobuyoshi Nakada 2020-06-21 11:31:48 +09:00
parent 838d695c16
commit ccd2f99e71
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -616,7 +616,7 @@ class TestPathname < Test::Unit::TestCase
def test_kernel_open def test_kernel_open
count = 0 count = 0
result = Kernel.open(Pathname.new(__FILE__)) {|f| result = Kernel.open(Pathname.new(__FILE__)) {|f|
assert(File.identical?(__FILE__, f)) assert_file.identical?(__FILE__, f)
count += 1 count += 1
2 2
} }
@ -1298,18 +1298,18 @@ class TestPathname < Test::Unit::TestCase
def test_mkdir def test_mkdir
with_tmpchdir('rubytest-pathname') {|dir| with_tmpchdir('rubytest-pathname') {|dir|
Pathname("d").mkdir Pathname("d").mkdir
assert(File.directory?("d")) assert_file.directory?("d")
Pathname("e").mkdir(0770) Pathname("e").mkdir(0770)
assert(File.directory?("e")) assert_file.directory?("e")
} }
end end
def test_rmdir def test_rmdir
with_tmpchdir('rubytest-pathname') {|dir| with_tmpchdir('rubytest-pathname') {|dir|
Pathname("d").mkdir Pathname("d").mkdir
assert(File.directory?("d")) assert_file.directory?("d")
Pathname("d").rmdir Pathname("d").rmdir
assert(!File.exist?("d")) assert_file.not_exist?("d")
} }
end end
@ -1372,16 +1372,16 @@ class TestPathname < Test::Unit::TestCase
def test_mkpath def test_mkpath
with_tmpchdir('rubytest-pathname') {|dir| with_tmpchdir('rubytest-pathname') {|dir|
Pathname("a/b/c/d").mkpath Pathname("a/b/c/d").mkpath
assert(File.directory?("a/b/c/d")) assert_file.directory?("a/b/c/d")
} }
end end
def test_rmtree def test_rmtree
with_tmpchdir('rubytest-pathname') {|dir| with_tmpchdir('rubytest-pathname') {|dir|
Pathname("a/b/c/d").mkpath Pathname("a/b/c/d").mkpath
assert(File.exist?("a/b/c/d")) assert_file.exist?("a/b/c/d")
Pathname("a").rmtree Pathname("a").rmtree
assert(!File.exist?("a")) assert_file.not_exist?("a")
} }
end end
@ -1389,10 +1389,10 @@ class TestPathname < Test::Unit::TestCase
with_tmpchdir('rubytest-pathname') {|dir| with_tmpchdir('rubytest-pathname') {|dir|
open("f", "w") {|f| f.write "abc" } open("f", "w") {|f| f.write "abc" }
Pathname("f").unlink Pathname("f").unlink
assert(!File.exist?("f")) assert_file.not_exist?("f")
Dir.mkdir("d") Dir.mkdir("d")
Pathname("d").unlink Pathname("d").unlink
assert(!File.exist?("d")) assert_file.not_exist?("d")
} }
end end
@ -1417,7 +1417,7 @@ class TestPathname < Test::Unit::TestCase
end end
def test_file_fnmatch def test_file_fnmatch
assert(File.fnmatch("*.*", Pathname.new("bar.baz"))) assert_file.fnmatch("*.*", Pathname.new("bar.baz"))
end end
def test_relative_path_from_casefold def test_relative_path_from_casefold