Revert "tests: make check should test against version in build tree, not installed"
[gnome.seed] / tests / javascript / builtin-argument-length.js
1 #!/usr/bin/env seed
2
3 testsuite = imports.testsuite
4
5 function correctArgs(fs, a)
6 {
7     try
8     {
9         eval(fs).apply(this, a)
10     }
11     catch(e)
12     {
13         if(e.name == "ArgumentError")
14             testsuite.unreachable(fs)
15     }
16 }
17
18 function wrongArgs(fs, a)
19 {
20     try
21     {
22         eval(fs).apply(this, a)
23         testsuite.unreachable(fs)
24     }
25     catch(e)
26     {
27         
28     }
29 }
30
31 wrongArgs("Seed.spawn", [])
32 correctArgs("Seed.spawn", ["asdfasdfasdf"])
33
34 wrongArgs("Seed.include", [])
35 wrongArgs("Seed.include", [1])
36 correctArgs("Seed.include", [""])
37 wrongArgs("Seed.include", [1,2])
38 wrongArgs("Seed.include", ["fail.js","another.js"])
39
40 wrongArgs("print", [])
41 wrongArgs("print", [1,2])
42 wrongArgs("print", ["asdf",2])
43 wrongArgs("print", [1,2,3])
44
45 wrongArgs("Seed.introspect", [])
46 correctArgs("Seed.introspect", [Seed])
47 wrongArgs("Seed.introspect", [Seed, 5.23])
48
49 wrongArgs("Seed.check_syntax", [])
50 correctArgs("Seed.check_syntax", ["asdfasdf"])
51 wrongArgs("Seed.check_syntax", ["5+5", "asdf"])
52