release 0.5.4
[swfdec.git] / test / trace / function-apply.as
blobcfc466518c155ed9ed540a0ae73994f976256e62
1 // makeswf -v 7 -r 1 -o function-apply-7.swf function-apply.as
3 #include "values.as"
5 var i = 0;
6 function test_function () {
7 trace ("this: " + this);
8 trace ("arguments: " + arguments.length + ": " + arguments);
9 return ++i;
12 var a = new Object ();
13 a.toString = function () { return "a"; };
14 a.test = test_function;
16 var b = new Object ();
17 b.toString = function () { return "b"; };
19 var fake_array = new Object ();
20 fake_array[0] = 1;
21 fake_array[1] = 2;
22 fake_array[2] = 3;
23 fake_array.length = 3;
25 trace ("Testing: (no arguments)");
26 trace (a.test.apply ());
27 trace ("Testing: a");
28 trace (a.test.apply (a));
29 trace ("Testing: a, [1, 2, 3]");
30 trace (a.test.apply (a, [1, 2, 3]));
31 trace ("Testing: a, [1, 2, 3], [4, 5]");
32 trace (a.test.apply (a, [1, 2, 3], [4, 5]));
33 trace ("Testing: a, 1, [2, 3]");
34 trace (a.test.apply (a, 1, [2, 3]));
35 trace ("Testing: a, 1, 2, 3");
36 trace (a.test.apply (a, 1, 2, 3));
37 trace ("Testing: a, fake_array");
38 trace (a.test.apply (a, fake_array));
39 trace ("Testing: b, [1, 2, 3]");
40 trace (a.test.apply (b, [1, 2, 3]));
42 for (var i = 0; i < values.length; i++) {
43 trace ("Testing: " + names[i] + ", [1, 2, 3]");
44 trace (a.test.apply (values[i], [1, 2, 3]));
47 loadMovie ("FSCommand:quit", "");