]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/builtins/command7.0
b8351f22f012b2892af3f969e33a5a40dc658c42
[apple/shell_cmds.git] / sh / tests / builtins / command7.0
1 # $FreeBSD: head/bin/sh/tests/builtins/command7.0 218356 2011-02-05 23:00:24Z jilles $
2
3 failures=0
4
5 check() {
6 if ! eval "[ $* ]"; then
7 echo "Failed: $*"
8 : $((failures += 1))
9 fi
10 }
11
12 check '"$(PATH=/libexec command -V ld-elf.so.1)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
13 check '"$(PATH=/libexec command -V ld-elf.so.1; :)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
14 check '"$(PATH=/libexec command -pv ld-elf.so.1)" = ""'
15 check '"$(PATH=/libexec command -pv ld-elf.so.1; :)" = ""'
16
17 PATH=/libexec:$PATH
18
19 check '"$(command -V ld-elf.so.1)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
20 check '"$(command -V ld-elf.so.1; :)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
21 check '"$(command -pv ld-elf.so.1)" = ""'
22 check '"$(command -pv ld-elf.so.1; :)" = ""'
23
24 PATH=/libexec
25
26 check '"$(command -v ls)" = ""'
27 case $(command -pv ls) in
28 /*/ls) ;;
29 *)
30 echo "Failed: \$(command -pv ls) match /*/ls"
31 : $((failures += 1)) ;;
32 esac
33
34 exit $((failures > 0))