diff --git a/js/js2/tests/calls.js b/js/js2/tests/calls.js index 726363184db..e69de29bb2d 100644 --- a/js/js2/tests/calls.js +++ b/js/js2/tests/calls.js @@ -1,93 +0,0 @@ - - -function f1(a = 1) { return a; } - -function f2(a, b = 1) { return a + b; } - -function f3(a, b = 1, c = 2) { return a + b + c; } - -function f4(a, b, c) { return a + b + c; } - - - -function f5(| a) { return a; } - -function f6(| a = 1) { return a; } - -function f7(| 'q' a = 1) { return a; } - - -function f8(a,| b) { return a + b; } - -function f9(a,| 'q' b) { return a + b; } - -function f10(a,| 'q' b = 1) { return a + b; } - - -function f11(a, b, c, ...) { return a + b + c; } - -function f12(a, b, c, ...d) { return a + b + c + d[0]; } - -function f13(a, b, c, ...d) { return a + b + c + d[0] + d[1]; } - - -function f14(| a, b, c) { return a + b - c; } - -function f15(| a, b = 2, c) { return a + b - c; } - - -count = 0; - -function verify(a, b) -{ - if (a == b) - print("Test " + count + " succeeded"); - else - print("Test " + count + " failed, expected " + b + ", got " + a); - count++; -} - -verify( f1(), 1); -verify( f1(2), 2); - -verify( f2(1), 2); -verify( f2(1,2), 3); - -verify( f3(1), 4); -verify( f3(1,2), 5); -verify( f3(1,2,3), 6); - -verify( f4(1,2,3), 6); - - -verify( f5(a:1), 1); - -verify( f6(), 1); -verify( f6(a:2), 2); - -verify( f7(a:1), 1); -verify( f7(q:1), 1); -verify( f7(), 1); - -verify( f8(1, b:2), 3); - -verify( f9(1, b:1), 2); -verify( f9(1, q:1), 2); - -verify( f10(1), 2); -verify( f10(1, b:2), 3); - -verify( f11(1, 2, 3), 6); - -verify( f12(1, 2, 3, 4), 10); -verify( f12(1, 2, 3, 4, 5), 10); - -verify( f13(1, 2, 3, 4, 5), 15); -verify( f13(1, 2, 3, 4, 5, 6), 15); - -verify( f14(a:4, b:2, c:3), 3); -verify( f14(c:3, b:2, a:4), 3); -verify( f14(b:2, a:4, c:3), 3); - -verify( f15(a:4, c:3), 3); - diff --git a/js/js2/tests/constructors.js b/js/js2/tests/constructors.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/js/js2/tests/fields.js b/js/js2/tests/fields.js index 8a3e2afd992..e69de29bb2d 100644 --- a/js/js2/tests/fields.js +++ b/js/js2/tests/fields.js @@ -1,34 +0,0 @@ -class C { -virtual var x:Integer; -var y:Integer; -} - -class D extends C { -override function set x(a:Integer):Integer {return y = a*2} -} - - -count = 0; - -function verify(a, b) -{ - if ((a == b) || ((b != b) && (a == undefined)) ) - print("Test " + count + " succeeded"); - else - print("Test " + count + " failed, expected " + b + ", got " + a); - count++; -} - - - var c:C = new C; - c.x = 5; - -verify(c.x, 5.0); -verify(c.y, NaN); - - var d:D = new D; - d.x = 5; - -verify(d.x, NaN); -verify(d.y, 10.0); - diff --git a/js/js2/tests/statics.js b/js/js2/tests/statics.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/js/js2/tests/verify.js b/js/js2/tests/verify.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/js2/src/tests/calls.js b/js2/src/tests/calls.js index 726363184db..e69de29bb2d 100644 --- a/js2/src/tests/calls.js +++ b/js2/src/tests/calls.js @@ -1,93 +0,0 @@ - - -function f1(a = 1) { return a; } - -function f2(a, b = 1) { return a + b; } - -function f3(a, b = 1, c = 2) { return a + b + c; } - -function f4(a, b, c) { return a + b + c; } - - - -function f5(| a) { return a; } - -function f6(| a = 1) { return a; } - -function f7(| 'q' a = 1) { return a; } - - -function f8(a,| b) { return a + b; } - -function f9(a,| 'q' b) { return a + b; } - -function f10(a,| 'q' b = 1) { return a + b; } - - -function f11(a, b, c, ...) { return a + b + c; } - -function f12(a, b, c, ...d) { return a + b + c + d[0]; } - -function f13(a, b, c, ...d) { return a + b + c + d[0] + d[1]; } - - -function f14(| a, b, c) { return a + b - c; } - -function f15(| a, b = 2, c) { return a + b - c; } - - -count = 0; - -function verify(a, b) -{ - if (a == b) - print("Test " + count + " succeeded"); - else - print("Test " + count + " failed, expected " + b + ", got " + a); - count++; -} - -verify( f1(), 1); -verify( f1(2), 2); - -verify( f2(1), 2); -verify( f2(1,2), 3); - -verify( f3(1), 4); -verify( f3(1,2), 5); -verify( f3(1,2,3), 6); - -verify( f4(1,2,3), 6); - - -verify( f5(a:1), 1); - -verify( f6(), 1); -verify( f6(a:2), 2); - -verify( f7(a:1), 1); -verify( f7(q:1), 1); -verify( f7(), 1); - -verify( f8(1, b:2), 3); - -verify( f9(1, b:1), 2); -verify( f9(1, q:1), 2); - -verify( f10(1), 2); -verify( f10(1, b:2), 3); - -verify( f11(1, 2, 3), 6); - -verify( f12(1, 2, 3, 4), 10); -verify( f12(1, 2, 3, 4, 5), 10); - -verify( f13(1, 2, 3, 4, 5), 15); -verify( f13(1, 2, 3, 4, 5, 6), 15); - -verify( f14(a:4, b:2, c:3), 3); -verify( f14(c:3, b:2, a:4), 3); -verify( f14(b:2, a:4, c:3), 3); - -verify( f15(a:4, c:3), 3); - diff --git a/js2/src/tests/constructors.js b/js2/src/tests/constructors.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/js2/src/tests/fields.js b/js2/src/tests/fields.js index 8a3e2afd992..e69de29bb2d 100644 --- a/js2/src/tests/fields.js +++ b/js2/src/tests/fields.js @@ -1,34 +0,0 @@ -class C { -virtual var x:Integer; -var y:Integer; -} - -class D extends C { -override function set x(a:Integer):Integer {return y = a*2} -} - - -count = 0; - -function verify(a, b) -{ - if ((a == b) || ((b != b) && (a == undefined)) ) - print("Test " + count + " succeeded"); - else - print("Test " + count + " failed, expected " + b + ", got " + a); - count++; -} - - - var c:C = new C; - c.x = 5; - -verify(c.x, 5.0); -verify(c.y, NaN); - - var d:D = new D; - d.x = 5; - -verify(d.x, NaN); -verify(d.y, 10.0); - diff --git a/js2/src/tests/statics.js b/js2/src/tests/statics.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/js2/src/tests/verify.js b/js2/src/tests/verify.js new file mode 100644 index 00000000000..e69de29bb2d