Skip to content

Commit

Permalink
Skip tests of test if the shell does not implement it
Browse files Browse the repository at this point in the history
If the testee does not implement the test utility as a built-in, the
test cases in tests/test-p.tst tests the behavior of the external
utility found in $PATH, which may (or may not) affect the results.
We should skip the tests if we are not sure if the shell supports the
built-in.
  • Loading branch information
magicant committed Nov 5, 2024
1 parent 00c7179 commit 0fe038e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test-p.tst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

posix="true"

# This file is for testing the shell built-in, so we should skip the tests
# if the shell does not seem to implement the test built-in.
case $("$TESTEE" -c 'command -V test') in
(*built-in*|*builtin*)
# Okay, the testee seems to support the test command as a built-in.
# This check is not POSIXly portable because the output of "command -V"
# is unspecified in POSIX, but it works for yash and most other shells.
;;
(*)
skip=true
;;
esac

umask u=rwx,go=

>file
Expand Down

0 comments on commit 0fe038e

Please sign in to comment.