forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b194d79
commit 2488815
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#/bin/sh | ||
|
||
setopt --verbose | ||
|
||
rm -rf shell-test | ||
mkdir shell-test | ||
cd shell-test | ||
|
||
# Simple sequence (grouping) | ||
{ echo test > testfile } | ||
test "$(cat testfile)" = "test" || echo cannot write to file in subshell && exit 1 | ||
|
||
# Simple sequence - many commands | ||
{ echo test1 > testfile; echo test2 > testfile } | ||
test "$(cat testfile)" = "test2" || echo cannot write to file in subshell 2 && exit 1 | ||
|
||
|
||
# Does it exit with the last exit code? | ||
{ test -z "a" } | ||
exitcode=$? | ||
test "$exitcode" -eq 1 || echo exits with $exitcode when it should exit with 1 && exit 1 | ||
|
||
{ test -z "a" || echo test } | ||
exitcode=$? | ||
test "$exitcode" -eq 0 || echo exits with $exitcode when it should exit with 0 && exit 1 | ||
|
||
cd .. | ||
rm -rf shell-test |