File: test-error.sh

package info (click to toggle)
grep 3.11-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 16,392 kB
  • sloc: ansic: 95,031; sh: 12,720; perl: 606; makefile: 386; awk: 71; sed: 16
file content (36 lines) | stat: -rwxr-xr-x 849 bytes parent folder | download | duplicates (10)
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
#!/bin/sh
# Test of the 'error' module.

. "${srcdir=.}/init.sh"; path_prepend_ .

${CHECKER} test-error${EXEEXT} > out 2> err
# Verify the exit code.
case $? in
  4) ;;
  *) Exit 1;;
esac

# Normalize the stderr output on Windows platforms.
tr -d '\015' < err | sed 's,.*test-error[.ex]*:,test-error:,' > err2 || Exit 1

# Verify the stderr output.
compare - err2 <<\EOF || Exit 1
test-error: bummer
test-error: Zonk 123 is too large
test-error: Pokémon started
test-error:d1/foo.c:10: invalid blub
test-error:d1/foo.c:10: invalid blarn
test-error:d1/foo.c:10: unsupported glink
test-error:d1/foo.c:13: invalid brump
test-error:d2/foo.c:13: unsupported flinge
hammer
boing 123 is too large
d2/bar.c:11: bark too loud
test-error: can't steal: Permission denied
test-error: fatal error
EOF

# Verify the stdout output.
test -s out && Exit 1

Exit 0