xref: /freebsd/bin/sh/tests/builtins/case9.0 (revision 51e235148a4becba94e824a44bd69687644a7f56)
1
2errors=0
3
4f() {
5	result=
6	case $1 in
7	a) result=${result}a ;;
8	b) result=${result}b ;&
9	c) result=${result}c ;&
10	d) result=${result}d ;;
11	e) result=${result}e ;&
12	esac
13}
14
15check() {
16	f "$1"
17	if [ "$result" != "$2" ]; then
18		printf "For %s, expected %s got %s\n" "$1" "$2" "$result"
19		errors=$((errors + 1))
20	fi
21}
22
23check '' ''
24check a a
25check b bcd
26check c cd
27check d d
28check e e
29
30if ! (case 1 in
31	1) false ;&
32	2) true ;;
33esac) then
34	echo "Subshell bad"
35	errors=$((errors + 1))
36fi
37
38exit $((errors != 0))
39