From 07cc858f16442bfdb6f061713ef2fb6fa38e8051 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 22 Sep 2026 19:45:55 +0900 Subject: [PATCH] Test tree removal and verify the `rmtree` alias Cover removal of existing and missing trees through `rm_rf` and verify the `rmtree` alias. Fix #188 --- test/fileutils/test_fileutils.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index 27511c2..c5eb829 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -1994,6 +1994,12 @@ def test_move def test_rm_rf check_singleton :rm_rf + FileUtils.mkdir_p('tmp/tree/child') + File.write('tmp/tree/child/file', "contents\n") + assert_equal(['tmp/tree'], FileUtils.rm_rf('tmp/tree')) + assert_file_not_exist('tmp/tree') + assert_equal(['tmp/missing'], FileUtils.rm_rf('tmp/missing')) + return if /mswin|mingw/ =~ RUBY_PLATFORM mkdir 'tmpdatadir' @@ -2045,6 +2051,7 @@ def test_rmdir def test_rmtree check_singleton :rmtree + assert_equal(FileUtils.method(:rm_rf), FileUtils.method(:rmtree)) end def test_safe_unlink