From 73249f5fd5aa2512817dbe1b3043b48e91f75f08 Mon Sep 17 00:00:00 2001 From: Johan Holmberg <holmberg556@gmail.com> Date: Tue, 26 May 2015 20:44:49 +0200 Subject: [PATCH] test use of 'chdir' --- t/CMDTEST_simple.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/t/CMDTEST_simple.rb b/t/CMDTEST_simple.rb index 74d93ff..d53990b 100644 --- a/t/CMDTEST_simple.rb +++ b/t/CMDTEST_simple.rb @@ -7,6 +7,30 @@ class CMDTEST_simple < Cmdtest::Testcase #----------------------------------- + def test_use_chdir + create_CMDTEST_foo [ + 'create_file "dir/file1", ["this is dir/file1"]', + 'chdir("dir")', + 'File.mtime("file1")', # exception if failing + 'create_file "file2", ["this is dir/file2"]', + 'cmd "cat file1" do', + ' stdout_equal ["this is dir/file1"]', + 'end', + 'cmd "cat file2" do', + ' stdout_equal ["this is dir/file2"]', + 'end', + ] + + cmd_cmdtest do + stdout_equal [ + '### cat file1', + '### cat file2', + ] + end + end + + #----------------------------------- + def test_try_to_run_non_existing_command_LINUX # return unless ! windows?