File: trap.t

package info (click to toggle)
posh 0.3.14
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,492 kB
  • ctags: 1,704
  • sloc: ansic: 15,481; xml: 1,555; perl: 943; sh: 897; makefile: 101
file content (43 lines) | stat: -rw-r--r-- 648 bytes parent folder | download | duplicates (2)
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

name: trap-1
description:
	Check if trap exit is ok (exit not mistaken for signal name)
stdin:
	trap 'echo hi' exit
	trap exit 1
expected-stdout: 
	hi
---

name: trap-2
description:
	Check if EXIT trap is executed for sub shells.
stdin:
	trap 'echo parent exit' EXIT
	echo start
	(echo A; echo A last)
	echo B
	(echo C; trap 'echo sub exit' EXIT; echo C last)
	echo parent last
expected-stdout: 
	start
	A
	A last
	B
	C
	C last
	sub exit
	parent last
	parent exit
---

name: trap-3
description:
	Check that trap errors when an action is given with no conditions
stdin:
	trap 0
expected-stderr-pattern:
	/.*no signals.*/
expected-exit: e != 0
---