summary refs log tree commit diff
path: root/bin/cash/tests/builtins/builtin1.0
blob: 3f419c2ea21738e53c21863c55b87ff2ecfa23b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# $FreeBSD: releng/12.0/bin/sh/tests/builtins/builtin1.0 201431 2010-01-03 15:01:38Z jilles $

failures=0

check() {
	if ! eval "[ $* ]"; then
		echo "Failed: $*"
		: $((failures += 1))
	fi
}

builtin : || echo "Bad return code at $LINENO"
builtin true || echo "Bad return code at $LINENO"
builtin ls 2>/dev/null && echo "Bad return code at $LINENO"
check '"$(builtin pwd)" = "$(pwd)"'
check '-z "$(builtin :)"'
check '-z "$(builtin true)"'
check '-z "$( (builtin nosuchtool) 2>/dev/null)"'
check '-z "$(builtin nosuchtool 2>/dev/null)"'
check '-z "$(builtin nosuchtool 2>/dev/null; :)"'
check '-z "$( (builtin ls) 2>/dev/null)"'
check '-z "$(builtin ls 2>/dev/null)"'
check '-z "$(builtin ls 2>/dev/null; :)"'
check '-n "$( (builtin nosuchtool) 2>&1)"'
check '-n "$(builtin nosuchtool 2>&1)"'
check '-n "$(builtin nosuchtool 2>&1; :)"'
check '-n "$( (builtin ls) 2>&1)"'
check '-n "$(builtin ls 2>&1)"'
check '-n "$(builtin ls 2>&1; :)"'

exit $((failures > 0))
d class='logsubject'>Create cash-kill.1June McEnroe 2019-01-10Create cash.1June McEnroe