summary refs log tree commit diff
path: root/bin/1sh/tests/expansion/cmdsubst1.0
blob: 7b8768a7527be672056facf7172dfaaaa954db17 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# $FreeBSD: releng/12.1/bin/sh/tests/expansion/cmdsubst1.0 201366 2010-01-01 18:17:46Z jilles $

failures=0

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

check '"$(echo abcde)" = "abcde"'
check '"$(echo abcde; :)" = "abcde"'

check '"$(printf abcde)" = "abcde"'
check '"$(printf abcde; :)" = "abcde"'

# regular
check '-n "$(umask)"'
check '-n "$(umask; :)"'
check '-n "$(umask 2>&1)"'
check '-n "$(umask 2>&1; :)"'

# special
check '-n "$(times)"'
check '-n "$(times; :)"'
check '-n "$(times 2>&1)"'
check '-n "$(times 2>&1; :)"'

# regular
check '".$(umask -@ 2>&1)." = ".umask: Illegal option -@."'
check '".$(umask -@ 2>&1; :)." = ".umask: Illegal option -@."'
check '".$({ umask -@; } 2>&1)." = ".umask: Illegal option -@."'

# special
check '".$(shift xyz 2>&1)." = ".shift: Illegal number: xyz."'
check '".$(shift xyz 2>&1; :)." = ".shift: Illegal number: xyz."'
check '".$({ shift xyz; } 2>&1)." = ".shift: Illegal number: xyz."'

v=1
check '-z "$(v=2 :)"'
check '"$v" = 1'
check '-z "$(v=3)"'
check '"$v" = 1'
check '"$(v=4 eval echo \$v)" = 4'
check '"$v" = 1'

exit $((failures > 0))
or theme and sizeJune McEnroe 2021-02-07Use scrot for up -s if no screencaptureJune McEnroe 2021-02-07Enable mouse acceleration in XJune McEnroe 2021-02-07Set colours for Xt and cwmJune McEnroe 2021-02-07Set urgency on bell in xtermJune McEnroe 2021-02-07Add bindings for brightness controlJune McEnroe 2021-02-07Set X key repeat rateJune McEnroe 2021-02-07Bump font size to 12June McEnroe 2021-02-07Fully configure and rebind cwmJune McEnroe 2021-02-07Add BintiJune McEnroe 2021-02-07Finish configuring xtermJune McEnroe 2021-02-06Enable tapping, reverse scroll, set scaling in wsconsctlJune McEnroe 2021-02-06Set root window to black on purple snowJune McEnroe 2021-02-06Add xmodmap configurationJune McEnroe 2021-02-06Add initial OpenBSD X configurationJune McEnroe 2021-02-06Add xterm output to schemeJune McEnroe