blob: 5843afe20c3121f46b437d5dde3a6a94e0f5bb77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
module parser
asset scripts:
path: ../asset/parser
def expect_load_success using p of (file : String):
send "load ${scripts.path}/$file.et" to p
expect /load-([a-z-]+).*/ from p capture done
guard (done == "done")
def expect_load_failure using p of (file : String) giving error:
send "load ${scripts.path}/$file.et" to p
expect /load-([a-z-]+) ([a-z-]+).*/ from p capture done, msg
guard (done == "failed")
guard (msg == error)
test Parser:
spawn as p
expect_load_failure using p of "non-existing-file" giving "file-not-found"
expect_load_success using p of "indent"
expect_load_success using p of "function"
expect_load_failure using p of "function-fail" giving "parse-error"
expect_load_success using p of "tags"
expect_load_success using p of "type-annotation"
test ParseUtf8:
spawn as p
expect_load_success using p of "utf8"
expect_load_failure using p of "invalid-utf8" giving "parse-error"
|