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