Compare predicate methods as a boolean value

This commit is contained in:
Nobuyoshi Nakada 2022-04-15 11:17:22 +09:00
Родитель a0040af671
Коммит 9db7d95968
1 изменённых файлов: 23 добавлений и 19 удалений

Просмотреть файл

@ -1516,26 +1516,26 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_equal(stat.atime, File.atime(f), f)
assert_equal(stat.ctime, File.ctime(f), f)
assert_equal(stat.mtime, File.mtime(f), f)
assert_equal(stat.blockdev?, File.blockdev?(f), f)
assert_equal(stat.chardev?, File.chardev?(f), f)
assert_equal(stat.directory?, File.directory?(f), f)
assert_equal(stat.file?, File.file?(f), f)
assert_equal(stat.setgid?, File.setgid?(f), f)
assert_equal(stat.grpowned?, File.grpowned?(f), f)
assert_equal(stat.sticky?, File.sticky?(f), f)
assert_equal(File.lstat(f).symlink?, File.symlink?(f), f)
assert_equal(stat.owned?, File.owned?(f), f)
assert_equal(stat.pipe?, File.pipe?(f), f)
assert_equal(stat.readable?, File.readable?(f), f)
assert_equal(stat.readable_real?, File.readable_real?(f), f)
assert_bool_equal(stat.blockdev?, File.blockdev?(f), f)
assert_bool_equal(stat.chardev?, File.chardev?(f), f)
assert_bool_equal(stat.directory?, File.directory?(f), f)
assert_bool_equal(stat.file?, File.file?(f), f)
assert_bool_equal(stat.setgid?, File.setgid?(f), f)
assert_bool_equal(stat.grpowned?, File.grpowned?(f), f)
assert_bool_equal(stat.sticky?, File.sticky?(f), f)
assert_bool_equal(File.lstat(f).symlink?, File.symlink?(f), f)
assert_bool_equal(stat.owned?, File.owned?(f), f)
assert_bool_equal(stat.pipe?, File.pipe?(f), f)
assert_bool_equal(stat.readable?, File.readable?(f), f)
assert_bool_equal(stat.readable_real?, File.readable_real?(f), f)
assert_equal(stat.size?, File.size?(f), f)
assert_equal(stat.socket?, File.socket?(f), f)
assert_equal(stat.setuid?, File.setuid?(f), f)
assert_equal(stat.writable?, File.writable?(f), f)
assert_equal(stat.writable_real?, File.writable_real?(f), f)
assert_equal(stat.executable?, File.executable?(f), f)
assert_equal(stat.executable_real?, File.executable_real?(f), f)
assert_equal(stat.zero?, File.zero?(f), f)
assert_bool_equal(stat.socket?, File.socket?(f), f)
assert_bool_equal(stat.setuid?, File.setuid?(f), f)
assert_bool_equal(stat.writable?, File.writable?(f), f)
assert_bool_equal(stat.writable_real?, File.writable_real?(f), f)
assert_bool_equal(stat.executable?, File.executable?(f), f)
assert_bool_equal(stat.executable_real?, File.executable_real?(f), f)
assert_bool_equal(stat.zero?, File.zero?(f), f)
end
assert_equal(false, test(?-, @dir, fn1))
assert_equal(true, test(?-, fn1, fn1))
@ -1788,4 +1788,8 @@ class TestFileExhaustive < Test::Unit::TestCase
dir = File.expand_path("/bar")
assert_equal(File.join(dir, "~foo"), File.absolute_path("~foo", dir))
end
def assert_bool_equal(expected, result, *messages)
assert_equal(expected, true & result, *messages)
end
end