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
b90eb5c
commit db18e75
Showing
1 changed file
with
46 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,46 @@ | ||
#!/bin/sh | ||
|
||
if test 1 -eq 1 { | ||
# Are comments ok? | ||
# Basic 'if' structure, empty block. | ||
if true { | ||
} else { | ||
exit 2 | ||
} | ||
if false { | ||
exit 2 | ||
} else { | ||
} | ||
|
||
# Basic 'if' structure, without 'else' | ||
if false { | ||
echo "Fail: 'if false' runs the branch" | ||
exit 2 | ||
} | ||
|
||
# Extended 'cond' form. | ||
if false { | ||
echo "Fail: 'if false' with 'else if' runs first branch" | ||
exit 2 | ||
} else if true { | ||
} else { | ||
echo "Fail: 'if false' with 'else if' runs last branch" | ||
exit 2 | ||
} | ||
|
||
# FIXME: Some form of 'not' would be nice | ||
# &&/|| in condition | ||
if true || false { | ||
} else { | ||
echo "Fail: 'if true || false' runs false branch" | ||
exit 2 | ||
} | ||
|
||
if true && false { | ||
echo "Fail: 'if true && false' runs true branch" | ||
exit 2 | ||
} | ||
} else { | ||
echo "Fail: 'if test 1 -eq 1' runs false branch" | ||
exit 1 | ||
} |