File: examples.test

package info (click to toggle)
shelltestrunner 1.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 896 kB
  • sloc: haskell: 881; makefile: 60; sh: 1
file content (23 lines) | stat: -rw-r--r-- 640 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 1. Test that the "echo" command (a shell builtin, usually)
# prints its argument on stdout, prints nothing on stderr,
# and exits with a zero exit code.

$ echo a
a

# 2. Test that echo with no arguments prints a blank line,
# no stderr output, and exits with zero.
# Since the output ends with whitespace, this time we must write
# the exit code test (>=) explicitly, to act as a delimiter.

$ echo

>=

# 3. Test that cat with a bad flag prints nothing on stdout,
# an error containing "unrecognized option" or "illegal option" on stderr,
# and exits with non-zero status.

$ cat --no-such-flag
>2 /(unrecognized|illegal) option/
>= !0