pack-redundant: consistent sort method
[gitweb.git] / t / t0061-run-command.sh
index d03149be9f667307a181ef17a3291ecc7eeb19cb..96bf6d6a7d0145334666fcd15373bad6ac66fd67 100755 (executable)
@@ -11,10 +11,15 @@ cat >hello-script <<-EOF
        #!$SHELL_PATH
        cat hello-script
 EOF
->empty
 
-test_expect_success 'start_command reports ENOENT' '
-       test-tool run-command start-command-ENOENT ./does-not-exist
+test_expect_success 'start_command reports ENOENT (slash)' '
+       test-tool run-command start-command-ENOENT ./does-not-exist 2>err &&
+       test_i18ngrep "\./does-not-exist" err
+'
+
+test_expect_success 'start_command reports ENOENT (no slash)' '
+       test-tool run-command start-command-ENOENT does-not-exist 2>err &&
+       test_i18ngrep "does-not-exist" err
 '
 
 test_expect_success 'run_command can run a command' '
@@ -23,7 +28,15 @@ test_expect_success 'run_command can run a command' '
        test-tool run-command run-command ./hello.sh >actual 2>err &&
 
        test_cmp hello-script actual &&
-       test_cmp empty err
+       test_must_be_empty err
+'
+
+test_expect_success 'run_command is restricted to PATH' '
+       write_script should-not-run <<-\EOF &&
+       echo yikes
+       EOF
+       test_must_fail test-tool run-command run-command should-not-run 2>err &&
+       test_i18ngrep "should-not-run" err
 '
 
 test_expect_success !MINGW 'run_command can run a script without a #! line' '
@@ -34,7 +47,7 @@ test_expect_success !MINGW 'run_command can run a script without a #! line' '
        test-tool run-command run-command ./hello >actual 2>err &&
 
        test_cmp hello-script actual &&
-       test_cmp empty err
+       test_must_be_empty err
 '
 
 test_expect_success 'run_command does not try to execute a directory' '
@@ -47,7 +60,7 @@ test_expect_success 'run_command does not try to execute a directory' '
        PATH=$PWD/bin1:$PWD/bin2:$PATH \
                test-tool run-command run-command greet >actual 2>err &&
        test_cmp bin2/greet actual &&
-       test_cmp empty err
+       test_must_be_empty err
 '
 
 test_expect_success POSIXPERM 'run_command passes over non-executable file' '
@@ -64,7 +77,7 @@ test_expect_success POSIXPERM 'run_command passes over non-executable file' '
        PATH=$PWD/bin1:$PWD/bin2:$PATH \
                test-tool run-command run-command greet >actual 2>err &&
        test_cmp bin2/greet actual &&
-       test_cmp empty err
+       test_must_be_empty err
 '
 
 test_expect_success POSIXPERM 'run_command reports EACCES' '
@@ -145,7 +158,7 @@ test_trace () {
        expect="$1"
        shift
        GIT_TRACE=1 test-tool run-command "$@" run-command true 2>&1 >/dev/null | \
-               sed 's/.* run_command: //' >actual &&
+               sed -e 's/.* run_command: //' -e '/trace: .*/d' >actual &&
        echo "$expect true" >expect &&
        test_cmp expect actual
 }