diff options
Diffstat (limited to 'js/src/tests/js1_3/Script')
-rw-r--r-- | js/src/tests/js1_3/Script/browser.js | 0 | ||||
-rw-r--r-- | js/src/tests/js1_3/Script/delete-001.js | 49 | ||||
-rw-r--r-- | js/src/tests/js1_3/Script/function-001-n.js | 45 | ||||
-rw-r--r-- | js/src/tests/js1_3/Script/function-002.js | 45 | ||||
-rw-r--r-- | js/src/tests/js1_3/Script/in-001.js | 35 | ||||
-rw-r--r-- | js/src/tests/js1_3/Script/new-001.js | 89 | ||||
-rw-r--r-- | js/src/tests/js1_3/Script/shell.js | 0 | ||||
-rw-r--r-- | js/src/tests/js1_3/Script/switch-001.js | 50 |
8 files changed, 313 insertions, 0 deletions
diff --git a/js/src/tests/js1_3/Script/browser.js b/js/src/tests/js1_3/Script/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_3/Script/browser.js diff --git a/js/src/tests/js1_3/Script/delete-001.js b/js/src/tests/js1_3/Script/delete-001.js new file mode 100644 index 000000000..757204ec1 --- /dev/null +++ b/js/src/tests/js1_3/Script/delete-001.js @@ -0,0 +1,49 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: delete-001.js + Section: regress + Description: + + Regression test for + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=108736 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + +var SECTION = "JS1_2"; +var VERSION = "JS1_2"; +var TITLE = "The variable statement"; + +startTest(); +writeHeaderToLog( SECTION + " "+ TITLE); + +// delete all properties of the global object +// per ecma, this does not affect variables in the global object declared +// with var or functions + +for ( p in this ) { + delete p; +} + +var result =""; + +for ( p in this ) { + result += String( p ); +} + +// not too picky here... just want to make sure we didn't crash or something + +new TestCase( SECTION, + "delete all properties of the global object", + "PASSED", + result == "" ? "FAILED" : "PASSED" ); + + +test(); + diff --git a/js/src/tests/js1_3/Script/function-001-n.js b/js/src/tests/js1_3/Script/function-001-n.js new file mode 100644 index 000000000..7d3726d0c --- /dev/null +++ b/js/src/tests/js1_3/Script/function-001-n.js @@ -0,0 +1,45 @@ +// |reftest| skip -- obsolete test +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + * File Name: boolean-001.js + * Description: + * + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 + * + * eval("function f(){}function g(){}") at top level is an error for JS1.2 + * and above (missing ; between named function expressions), but declares f + * and g as functions below 1.2. + * + * Fails to produce error regardless of version: + * js> version(100) + * 120 + * js> eval("function f(){}function g(){}") + * js> version(120); + * 100 + * js> eval("function f(){}function g(){}") + * js> + * Author: christine@netscape.com + * Date: 11 August 1998 + */ +var SECTION = "function-001.js"; +var VERSION = "JS_1.3"; +var TITLE = "functions not separated by semicolons are errors in version 120 and higher"; +var BUGNUMBER="10278"; + +startTest(); +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( + SECTION, + "eval(\"function f(){}function g(){}\")", + "error", + eval("function f(){}function g(){}") ); + +test(); + + diff --git a/js/src/tests/js1_3/Script/function-002.js b/js/src/tests/js1_3/Script/function-002.js new file mode 100644 index 000000000..144e2e4b0 --- /dev/null +++ b/js/src/tests/js1_3/Script/function-002.js @@ -0,0 +1,45 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: function-002.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=249579 + + function definitions in conditional statements should be allowed. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ +var SECTION = "function-002"; +var VERSION = "JS1_3"; +var TITLE = "Regression test for 249579"; +var BUGNUMBER="249579"; + +startTest(); +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( + SECTION, + "0?function(){}:0", + 0, + 0?function(){}:0 ); + + +bar = true; +foo = bar ? function () { return true; } : function() { return false; }; + +new TestCase( + SECTION, + "bar = true; foo = bar ? function () { return true; } : function() { return false; }; foo()", + true, + foo() ); + + +test(); + diff --git a/js/src/tests/js1_3/Script/in-001.js b/js/src/tests/js1_3/Script/in-001.js new file mode 100644 index 000000000..298cf5942 --- /dev/null +++ b/js/src/tests/js1_3/Script/in-001.js @@ -0,0 +1,35 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: in-001.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=196109 + + + Author: christine@netscape.com + Date: 12 november 1997 +*/ +var SECTION = "in-001"; +var VERSION = "JS1_3"; +var TITLE = "Regression test for 196109"; +var BUGNUMBER="196109"; + +startTest(); +writeHeaderToLog( SECTION + " "+ TITLE); + +o = {}; +o.foo = 'sil'; + +new TestCase( + SECTION, + "\"foo\" in o", + true, + "foo" in o ); + +test(); diff --git a/js/src/tests/js1_3/Script/new-001.js b/js/src/tests/js1_3/Script/new-001.js new file mode 100644 index 000000000..9e7c5c28c --- /dev/null +++ b/js/src/tests/js1_3/Script/new-001.js @@ -0,0 +1,89 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: new-001.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=76103 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ +var SECTION = "new-001"; +var VERSION = "JS1_3"; +var TITLE = "new-001"; +var BUGNUMBER="31567"; + +startTest(); +writeHeaderToLog( SECTION + " "+ TITLE); + +function Test_One (x) { + this.v = x+1; + return x*2 + } + +function Test_Two( x, y ) { + this.v = x; + return y; +} + +new TestCase( + SECTION, + "Test_One(18)", + 36, + Test_One(18) ); + +new TestCase( + SECTION, + "new Test_One(18)", + "[object Object]", + new Test_One(18) +"" ); + +new TestCase( + SECTION, + "new Test_One(18).v", + 19, + new Test_One(18).v ); + +new TestCase( + SECTION, + "Test_Two(2,7)", + 7, + Test_Two(2,7) ); + +new TestCase( + SECTION, + "new Test_Two(2,7)", + "[object Object]", + new Test_Two(2,7) +"" ); + +new TestCase( + SECTION, + "new Test_Two(2,7).v", + 2, + new Test_Two(2,7).v ); + +new TestCase( + SECTION, + "new (Function)(\"x\", \"return x+3\")(5,6)", + 8, + new (Function)("x","return x+3")(5,6) ); + +new TestCase( + SECTION, + "new new Test_Two(String, 2).v(0123)", + "83", + new new Test_Two(String, 2).v(0123) +""); + +new TestCase( + SECTION, + "new new Test_Two(String, 2).v(0123).length", + 2, + new new Test_Two(String, 2).v(0123).length ); + +test(); diff --git a/js/src/tests/js1_3/Script/shell.js b/js/src/tests/js1_3/Script/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_3/Script/shell.js diff --git a/js/src/tests/js1_3/Script/switch-001.js b/js/src/tests/js1_3/Script/switch-001.js new file mode 100644 index 000000000..aad1505db --- /dev/null +++ b/js/src/tests/js1_3/Script/switch-001.js @@ -0,0 +1,50 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: switch-001.js + Section: + Description: + + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315767 + + Verify that switches do not use strict equality in + versions of JavaScript < 1.4 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ +var SECTION = "switch-001"; +var VERSION = "JS1_3"; +var TITLE = "switch-001"; +var BUGNUMBER="315767"; + +startTest(); +writeHeaderToLog( SECTION + " "+ TITLE); + +result = "fail: did not enter switch"; + +switch (true) { +case 1: + result = "fail: for backwards compatibility, version 130 use strict equality"; + break; +case true: + result = "pass"; + break; +default: + result = "fail: evaluated default statement"; +} + +new TestCase( + SECTION, + "switch / case should use strict equality in version of JS < 1.4", + "pass", + result ); + + + +test(); + |