Skip to content

Commit

Permalink
update example tests
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichael committed Sep 12, 2023
1 parent 136a7f1 commit 7fbdf2a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
14 changes: 0 additions & 14 deletions tests/examples/cat.test

This file was deleted.

3 changes: 0 additions & 3 deletions tests/examples/echo.test

This file was deleted.

23 changes: 23 additions & 0 deletions tests/examples/examples.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
4 changes: 0 additions & 4 deletions tests/print/print-format1.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@

$ shelltest --print=v1 tests/examples/cat.test | diff -u - tests/examples/cat.test

$ shelltest --print=v1 tests/examples/echo.test | diff -u - tests/examples/echo.test

$ shelltest --print=v1 tests/format1/abstract-test-with-macros | diff -u - tests/format1/abstract-test-with-macros

0 comments on commit 7fbdf2a

Please sign in to comment.