summaryrefslogtreecommitdiff
path: root/test/fileutils/test_fileutils.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/fileutils/test_fileutils.rb')
-rw-r--r--test/fileutils/test_fileutils.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index 4480c2745b..41100e12a9 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -6,6 +6,7 @@ require 'etc'
require_relative 'fileasserts'
require 'pathname'
require 'tmpdir'
+require 'stringio'
require 'test/unit'
class TestFileUtils < Test::Unit::TestCase
@@ -1673,6 +1674,29 @@ class TestFileUtils < Test::Unit::TestCase
check_singleton :chdir
end
+ def test_chdir_verbose
+ assert_output_lines(["cd .", "cd -"], FileUtils) do
+ FileUtils.chdir('.', verbose: true){}
+ end
+ end
+
+ def test_chdir_verbose_frozen
+ o = Object.new
+ o.extend(FileUtils)
+ o.singleton_class.send(:public, :chdir)
+ o.freeze
+ orig_stderr = $stderr
+ $stderr = StringIO.new
+ o.chdir('.', verbose: true){}
+ $stderr.rewind
+ assert_equal(<<-END, $stderr.read)
+cd .
+cd -
+ END
+ ensure
+ $stderr = orig_stderr if orig_stderr
+ end
+
def test_getwd
check_singleton :getwd
end