1 // We can't use normal shouldBe here, since they'd eval in the wrong context...
3 function shouldBeOfType(msg, val, type) {
4 if (typeof(val) != type)
5 testFailed(msg + ": value has type " + typeof(val) + " , not:" + type);
12 // var execution should not overwrite something that was
13 // in scope beforehand -- e.g. the arguments thing
14 shouldBeOfType("test0", arguments, 'object');
18 // No need to undef-initialize something in scope already!
19 shouldBeOfType("test1", arguments, 'object');
23 function test2(arguments) {
24 // Formals OTOH can overwrite the args object
25 shouldBeOfType("test2", arguments, 'number');
30 // Ditto for functions..
31 shouldBeOfType("test3", arguments, 'function');
32 function arguments() {}
36 // Here, the -declaration- part of the var below should have no
38 shouldBeOfType('test4.(1)', arguments, 'object');
40 // .. but the assignment shoud just happen
41 shouldBeOfType('test4.(2)', arguments, 'number');