ruby-changes:61874
From: Nobuyoshi <ko1@a...>
Date: Sun, 21 Jun 2020 12:04:03 +0900 (JST)
Subject: [ruby-changes:61874] ccd2f99e71 (master): Prefer more descriptive assertion methods
https://git.ruby-lang.org/ruby.git/commit/?id=ccd2f99e71 From ccd2f99e71162bddc24bf2ff76576c3ce65fcbb8 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 21 Jun 2020 11:31:48 +0900 Subject: Prefer more descriptive assertion methods diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb index 2ce32a6..77958b6 100644 --- a/test/pathname/test_pathname.rb +++ b/test/pathname/test_pathname.rb @@ -616,7 +616,7 @@ class TestPathname < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/pathname/test_pathname.rb#L616 def test_kernel_open count = 0 result = Kernel.open(Pathname.new(__FILE__)) {|f| - assert(File.identical?(__FILE__, f)) + assert_file.identical?(__FILE__, f) count += 1 2 } @@ -1298,18 +1298,18 @@ class TestPathname < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/pathname/test_pathname.rb#L1298 def test_mkdir with_tmpchdir('rubytest-pathname') {|dir| Pathname("d").mkdir - assert(File.directory?("d")) + assert_file.directory?("d") Pathname("e").mkdir(0770) - assert(File.directory?("e")) + assert_file.directory?("e") } end def test_rmdir with_tmpchdir('rubytest-pathname') {|dir| Pathname("d").mkdir - assert(File.directory?("d")) + assert_file.directory?("d") Pathname("d").rmdir - assert(!File.exist?("d")) + assert_file.not_exist?("d") } end @@ -1372,16 +1372,16 @@ class TestPathname < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/pathname/test_pathname.rb#L1372 def test_mkpath with_tmpchdir('rubytest-pathname') {|dir| Pathname("a/b/c/d").mkpath - assert(File.directory?("a/b/c/d")) + assert_file.directory?("a/b/c/d") } end def test_rmtree with_tmpchdir('rubytest-pathname') {|dir| Pathname("a/b/c/d").mkpath - assert(File.exist?("a/b/c/d")) + assert_file.exist?("a/b/c/d") Pathname("a").rmtree - assert(!File.exist?("a")) + assert_file.not_exist?("a") } end @@ -1389,10 +1389,10 @@ class TestPathname < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/pathname/test_pathname.rb#L1389 with_tmpchdir('rubytest-pathname') {|dir| open("f", "w") {|f| f.write "abc" } Pathname("f").unlink - assert(!File.exist?("f")) + assert_file.not_exist?("f") Dir.mkdir("d") Pathname("d").unlink - assert(!File.exist?("d")) + assert_file.not_exist?("d") } end @@ -1417,7 +1417,7 @@ class TestPathname < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/pathname/test_pathname.rb#L1417 end def test_file_fnmatch - assert(File.fnmatch("*.*", Pathname.new("bar.baz"))) + assert_file.fnmatch("*.*", Pathname.new("bar.baz")) end def test_relative_path_from_casefold -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/