summary refs log tree commit diff
path: root/bin/1sh/tests/expansion/cmdsubst2.0
blob: cf533c34c2cd76b5fe43c1fe30711d41043f5c9c (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
# $FreeBSD: releng/12.1/bin/sh/tests/expansion/cmdsubst2.0 205105 2010-03-12 23:23:46Z jilles $

failures=0

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

check '`echo /et[c]/` = "/etc/"'
check '`printf /var/empty%s /et[c]/` = "/var/empty/etc/"'
check '"`echo /et[c]/`" = "/etc/"'
check '`echo "/et[c]/"` = "/etc/"'
check '`printf /var/empty%s "/et[c]/"` = "/var/empty/et[c]/"'
check '`printf /var/empty/%s \"/et[c]/\"` = "/var/empty/\"/et[c]/\""'
check '"`echo \"/et[c]/\"`" = "/et[c]/"'
check '"`echo "/et[c]/"`" = "/et[c]/"'
check '`echo $$` = $$'
check '"`echo $$`" = $$'
check '`echo \$\$` = $$'
check '"`echo \$\$`" = $$'

# Command substitutions consisting of a single builtin may be treated
# differently.
check '`:; echo /et[c]/` = "/etc/"'
check '`:; printf /var/empty%s /et[c]/` = "/var/empty/etc/"'
check '"`:; echo /et[c]/`" = "/etc/"'
check '`:; echo "/et[c]/"` = "/etc/"'
check '`:; printf /var/empty%s "/et[c]/"` = "/var/empty/et[c]/"'
check '`:; printf /var/empty/%s \"/et[c]/\"` = "/var/empty/\"/et[c]/\""'
check '"`:; echo \"/et[c]/\"`" = "/et[c]/"'
check '"`:; echo "/et[c]/"`" = "/et[c]/"'
check '`:; echo $$` = $$'
check '"`:; echo $$`" = $$'
check '`:; echo \$\$` = $$'
check '"`:; echo \$\$`" = $$'

check '`set -f; echo /et[c]/` = "/etc/"'
check '"`set -f; echo /et[c]/`" = "/et[c]/"'

exit $((failures > 0))
Escape \ and / in mtags search patternsJune McEnroe 2021-01-20Use mtags in source-filterJune McEnroe 2021-01-19Add mtags to generate tags for make and mdocJune McEnroe 2021-01-19Map tags to IDs using only [[:alnum:]-._]June McEnroe 2021-01-19Don't use a pager if reading standard inputJune McEnroe 2021-01-19Support BSD make syntax and match *.amJune McEnroe 2021-01-19Match tab following escaped newline in make assignmentsJune McEnroe 2021-01-18Allow matching lexers using first input lineJune McEnroe