-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.js
51 lines (42 loc) · 1.46 KB
/
tests.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// TODO: once AST settles down, start filling in regression tests
exports.tests = function (test,opts,pc,grammar) {
var tests = {
test_token: function () {
var parser = pc.token("hi");
var src = "hihih";
test("test_token",opts,pc,grammar,{rule:parser,src:src});
},
test_sequence: function () {
var parser = pc.sequence("hi","ho");
var src = "hihih";
test("test_sequence",opts,pc,grammar,{rule:parser,src:src});
},
test_repeat0: function () {
var parser = pc.repeat0("hi");
var src = "hihih";
test("test_repeat0",opts,pc,grammar,{rule:parser,src:src});
},
test_choice: function () {
var parser = pc.choice("hi","ho");
var src = "hihih";
test("test_choice",opts,pc,grammar,{rule:parser,src:src});
},
test_complex: function () {
var parser = pc.repeat0(pc.sequence(pc.choice(pc.sequence("hi","ho")
,pc.sequence("hi","x")
,pc.optional("hu")
,""
)
,"hi"
));
var src = "hihih";
test("test_complex",opts,pc,grammar,{rule:parser,src:src});
}
};
tests.test_complex();
/*
for (var t in tests)
if (tests.hasOwnProperty(t))
tests[t]();
*/
};