-
Notifications
You must be signed in to change notification settings - Fork 191
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
Showing
4 changed files
with
251 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,117 @@ | ||
Too many parentheses | ||
|
||
$ echo '())' | wasmoo_util pp | ||
File "-", line 1, characters 2-3: | ||
Unexpected closing parenthesis. | ||
[1] | ||
|
||
Missing parenthesis | ||
|
||
$ echo '(()' | wasmoo_util pp | ||
File "-", line 2, characters 0-0: | ||
Unexpected end of file. | ||
[1] | ||
|
||
Bad conditional | ||
|
||
$ echo '(@if)' | wasmoo_util pp | ||
File "-", line 1, characters 4-5: | ||
Expecting condition. | ||
[1] | ||
|
||
$ echo '(@if a)' | wasmoo_util pp | ||
File "-", line 1, characters 6-7: | ||
Expecting @then clause. | ||
[1] | ||
|
||
$ echo '(@if a xxx)' | wasmoo_util pp | ||
File "-", line 1, characters 7-10: | ||
Expecting @then clause. | ||
[1] | ||
|
||
$ echo '(@if a (@then) xx)' | wasmoo_util pp | ||
File "-", line 1, characters 15-17: | ||
Expecting @else clause or closing parenthesis. | ||
[1] | ||
|
||
$ echo '(@if a (@then) (@else) xx)' | wasmoo_util pp | ||
File "-", line 1, characters 23-25: | ||
Expecting closing parenthesis. | ||
[1] | ||
|
||
Syntax error in condition | ||
|
||
$ echo '(@if () (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 5-7: | ||
Syntax error. | ||
[1] | ||
|
||
$ echo '(@if (not) (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 5-10: | ||
Syntax error. | ||
[1] | ||
|
||
$ echo '(@if (not (and) (or)) (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 5-21: | ||
Syntax error. | ||
[1] | ||
|
||
$ echo '(@if (= "a") (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 5-12: | ||
Syntax error. | ||
[1] | ||
|
||
$ echo '(@if (= "a" "b" "c") (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 5-20: | ||
Syntax error. | ||
[1] | ||
|
||
Lonely @then or @else | ||
|
||
$ echo '(@then)' | wasmoo_util pp | ||
File "-", line 1, characters 5-20: | ||
Syntax error. | ||
[1] | ||
|
||
$ echo '(@else)' | wasmoo_util pp | ||
File "-", line 1, characters 5-20: | ||
Syntax error. | ||
[1] | ||
|
||
$ echo '(@if (and) (@then (@else)))' | wasmoo_util pp | ||
File "-", line 1, characters 5-20: | ||
Syntax error. | ||
[1] | ||
|
||
Undefined variable | ||
|
||
$ echo '(@if a (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 5-6: | ||
Unknown variable 'a'. | ||
[1] | ||
|
||
Wrong type | ||
$ echo '(@if "" (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 5-7: | ||
Expected a boolean but this is a string. | ||
[1] | ||
|
||
$ echo '(@if (not "") (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 10-12: | ||
Expected a boolean but this is a string. | ||
[1] | ||
|
||
$ echo '(@if (and "") (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 10-12: | ||
Expected a boolean but this is a string. | ||
[1] | ||
|
||
$ echo '(@if (or "") (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 9-11: | ||
Expected a boolean but this is a string. | ||
[1] | ||
|
||
$ echo '(@if (= (and) "") (@then))' | wasmoo_util pp | ||
File "-", line 1, characters 14-16: | ||
Expected a boolean but this is a string. | ||
[1] |
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,8 @@ | ||
|
||
(rule | ||
(with-stdout-to tests.output | ||
(run wasmoo_util pp --enable a --disable b --set c=1 %{dep:tests.txt}))) | ||
|
||
(rule | ||
(alias runtest) | ||
(action (diff tests.expected tests.output))) |
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,63 @@ | ||
;; conditional | ||
a is true | ||
b is false | ||
a is true | ||
|
||
|
||
;; nested conditionals | ||
a is true and b is false | ||
|
||
|
||
;; not | ||
|
||
b is false | ||
|
||
;; and | ||
true | ||
a is true | ||
|
||
|
||
a is true and b is false | ||
|
||
|
||
|
||
;; or | ||
|
||
a is true | ||
|
||
a or b is true | ||
a is true or b is false | ||
|
||
a or b is false | ||
|
||
;; string comparisons | ||
c is 1 | ||
|
||
|
||
c is not 2 | ||
|
||
;; version comparisons | ||
|
||
(4 1 1) = (4 1 1) | ||
|
||
(4 1 1) <> (4 1 0) | ||
|
||
(4 1 1) <> (4 1 2) | ||
|
||
(4 1 1) <= (4 1 1) | ||
(4 1 1) <= (4 1 2) | ||
(4 1 1) >= (4 1 0) | ||
(4 1 1) >= (4 1 1) | ||
|
||
(4 1 1) > (4 1 0) | ||
|
||
|
||
|
||
;; version comparisons: lexicographic order | ||
|
||
|
||
(4 1 1) < (4 1 2) | ||
|
||
(4 1 1) < (4 2 0) | ||
(4 1 1) < (5 0 1) | ||
|
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,63 @@ | ||
;; conditional | ||
(@if a (@then a is true) (@else a is false)) | ||
(@if b (@then b is true) (@else b is false)) | ||
(@if a (@then a is true)) | ||
(@if b (@then b is true)) | ||
|
||
;; nested conditionals | ||
(@if a (@then (@if b (@then a and b are true) (@else a is true and b is false))) | ||
(@else (@if b (@then a is false and b is true) (@else a and b are false)))) | ||
|
||
;; not | ||
(@if (not a) (@then a is false)) | ||
(@if (not b) (@then b is false)) | ||
|
||
;; and | ||
(@if (and) (@then true)) | ||
(@if (and a) (@then a is true)) | ||
(@if (and b) (@then b is true)) | ||
(@if (and a b) (@then a and b are true)) | ||
(@if (and a (not b)) (@then a is true and b is false)) | ||
(@if (and (not a) b) (@then a is false and b is true)) | ||
(@if (and (not a) (not b)) (@then a and b are false)) | ||
|
||
;; or | ||
(@if (or) (@then false)) | ||
(@if (or a) (@then a is true)) | ||
(@if (or b) (@then b is true)) | ||
(@if (or a b) (@then a or b is true)) | ||
(@if (or a (not b)) (@then a is true or b is false)) | ||
(@if (or (not a) b) (@then a is false or b is true)) | ||
(@if (or (not a) (not b)) (@then a or b is false)) | ||
|
||
;; string comparisons | ||
(@if (= c "1") (@then c is 1)) | ||
(@if (= c "2") (@then c is 2)) | ||
(@if (<> c "1") (@then c is not 1)) | ||
(@if (<> c "2") (@then c is not 2)) | ||
|
||
;; version comparisons | ||
(@if (= (4 1 1) (4 1 0)) (@then (4 1 1) = (4 1 0))) | ||
(@if (= (4 1 1) (4 1 1)) (@then (4 1 1) = (4 1 1))) | ||
(@if (= (4 1 1) (4 1 2)) (@then (4 1 1) = (4 1 2))) | ||
(@if (<> (4 1 1) (4 1 0)) (@then (4 1 1) <> (4 1 0))) | ||
(@if (<> (4 1 1) (4 1 1)) (@then (4 1 1) <> (4 1 1))) | ||
(@if (<> (4 1 1) (4 1 2)) (@then (4 1 1) <> (4 1 2))) | ||
(@if (<= (4 1 1) (4 1 0)) (@then (4 1 1) <= (4 1 0))) | ||
(@if (<= (4 1 1) (4 1 1)) (@then (4 1 1) <= (4 1 1))) | ||
(@if (<= (4 1 1) (4 1 2)) (@then (4 1 1) <= (4 1 2))) | ||
(@if (>= (4 1 1) (4 1 0)) (@then (4 1 1) >= (4 1 0))) | ||
(@if (>= (4 1 1) (4 1 1)) (@then (4 1 1) >= (4 1 1))) | ||
(@if (>= (4 1 1) (4 1 2)) (@then (4 1 1) >= (4 1 2))) | ||
(@if (> (4 1 1) (4 1 0)) (@then (4 1 1) > (4 1 0))) | ||
(@if (> (4 1 1) (4 1 1)) (@then (4 1 1) > (4 1 1))) | ||
(@if (> (4 1 1) (4 1 2)) (@then (4 1 1) > (4 1 2))) | ||
|
||
;; version comparisons: lexicographic order | ||
(@if (< (4 1 1) (4 1 0)) (@then (4 1 1) < (4 1 0))) | ||
(@if (< (4 1 1) (4 1 1)) (@then (4 1 1) < (4 1 1))) | ||
(@if (< (4 1 1) (4 1 2)) (@then (4 1 1) < (4 1 2))) | ||
(@if (< (4 1 1) (4 0 2)) (@then (4 1 1) < (4 0 2))) | ||
(@if (< (4 1 1) (4 2 0)) (@then (4 1 1) < (4 2 0))) | ||
(@if (< (4 1 1) (5 0 1)) (@then (4 1 1) < (5 0 1))) | ||
(@if (< (4 1 1) (3 2 1)) (@then (4 1 1) < (3 2 1))) |