-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added the following built-in keyowrds:
assert
, assert_eq
and `a…
…ssert_ne` which will stop the program execution when they don't evaluate to a true value. Example: assert(1 == 2); # assert: not true at script.sf line 1. assert_eq(1, 2); # assert_eq: 1 == 2 is false at script.sf line 2. assert_ne(1, 1); # assert_ne: 1 != 1 is false at script.sf line 3. Alternatively: assert(1 == 1); # ok assert_eq(1, 1); # ok assert_ne(1, 2); # ok
- Loading branch information
trizen
committed
Jul 21, 2015
1 parent
98fc865
commit 354e22e
Showing
7 changed files
with
60 additions
and
22 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
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
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
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
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
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
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,19 @@ | ||
#!/usr/bin/ruby | ||
|
||
# Tests for prefix methods | ||
|
||
assert_eq(run { "hi" }, "hi"); | ||
assert_eq(run { var run = 42; run }, 42); | ||
assert_eq(run { "hi" }, "hi"); | ||
|
||
var i = int 12.5; | ||
|
||
assert_eq(i, 12); | ||
assert_eq(lc "TeSt", "test"); | ||
assert_eq(ceil 12.1.add(2), 15); | ||
|
||
var int = 42; | ||
assert_eq(int, 42); | ||
assert_eq(CORE::int 12.5, 12); | ||
|
||
say "** Test passed!"; |