diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:41 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:41 -0800 |
commit | 648161bb0edfc3d43db63caed5cc5213bc6cb78f (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /JavaScriptCore/tests/mozilla/js1_3 | |
parent | a65af38181ac7d34544586bdb5cd004de93897ad (diff) | |
download | external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.zip external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.tar.gz external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'JavaScriptCore/tests/mozilla/js1_3')
29 files changed, 0 insertions, 3233 deletions
diff --git a/JavaScriptCore/tests/mozilla/js1_3/Boolean/boolean-001.js b/JavaScriptCore/tests/mozilla/js1_3/Boolean/boolean-001.js deleted file mode 100644 index 991730d..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/Boolean/boolean-001.js +++ /dev/null @@ -1,73 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - * File Name: boolean-001.js - * Description: - * - * In JavaScript 1.2, new Boolean(false) evaluates to false. - * - * Author: christine@netscape.com - * Date: 11 August 1998 - */ - var SECTION = "boolean-001.js"; - var VERSION = "JS_1.3"; - var TITLE = "new Boolean(false) should evaluate to false"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - - BooleanTest( "new Boolean(true)", new Boolean(true), true ); - BooleanTest( "new Boolean(false)", new Boolean(false), true ); - BooleanTest( "true", true, true ); - BooleanTest( "false", false, false ); - - test(); - -function BooleanTest( string, object, expect ) { - if ( object ) { - result = true; - } else { - result = false; - } - - testcases[tc++] = new TestCase( - SECTION, - string, - expect, - result ); -} - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/Script/delete-001.js b/JavaScriptCore/tests/mozilla/js1_3/Script/delete-001.js deleted file mode 100644 index e2f4332..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/Script/delete-001.js +++ /dev/null @@ -1,79 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - 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 statment"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - - // 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 - - testcases[testcases.length] = new TestCase( SECTION, - "delete all properties of the global object", - "PASSED", - result == "" ? "FAILED" : "PASSED" ); - - - test(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/Script/function-001-n.js b/JavaScriptCore/tests/mozilla/js1_3/Script/function-001-n.js deleted file mode 100644 index 5b4add0..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/Script/function-001-n.js +++ /dev/null @@ -1,74 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - * 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); - - var testcases = new Array(); - - testcases[tc++] = new TestCase( - SECTION, - "eval(\"function f(){}function g(){}\")", - "error", - eval("function f(){}function g(){}") ); - - test(); - - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/Script/function-002.js b/JavaScriptCore/tests/mozilla/js1_3/Script/function-002.js deleted file mode 100644 index d3d1d85..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/Script/function-002.js +++ /dev/null @@ -1,75 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - 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); - - var testcases = new Array(); - - testcases[tc++] = new TestCase( - SECTION, - "0?function(){}:0", - 0, - 0?function(){}:0 ); - - - bar = true; - foo = bar ? function () { return true; } : function() { return false; }; - - testcases[tc++] = new TestCase( - SECTION, - "bar = true; foo = bar ? function () { return true; } : function() { return false; }; foo()", - true, - foo() ); - - - test(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/Script/in-001.js b/JavaScriptCore/tests/mozilla/js1_3/Script/in-001.js deleted file mode 100644 index d9d76fe..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/Script/in-001.js +++ /dev/null @@ -1,52 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - 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); - - var testcases = new Array(); - - o = {}; - o.foo = 'sil'; - - testcases[tc++] = new TestCase( - SECTION, - "\"foo\" in o", - true, - "foo" in o ); - - test(); diff --git a/JavaScriptCore/tests/mozilla/js1_3/Script/new-001.js b/JavaScriptCore/tests/mozilla/js1_3/Script/new-001.js deleted file mode 100644 index 2868eca..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/Script/new-001.js +++ /dev/null @@ -1,120 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - 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); - - var testcases = new Array(); - - function Test_One (x) { - this.v = x+1; - return x*2 - } - - function Test_Two( x, y ) { - this.v = x; - return y; - } - - testcases[tc++] = new TestCase( - SECTION, - "Test_One(18)", - 36, - Test_One(18) ); - - testcases[tc++] = new TestCase( - SECTION, - "new Test_One(18)", - "[object Object]", - new Test_One(18) +"" ); - - testcases[tc++] = new TestCase( - SECTION, - "new Test_One(18).v", - 19, - new Test_One(18).v ); - - testcases[tc++] = new TestCase( - SECTION, - "Test_Two(2,7)", - 7, - Test_Two(2,7) ); - - testcases[tc++] = new TestCase( - SECTION, - "new Test_Two(2,7)", - "[object Object]", - new Test_Two(2,7) +"" ); - - testcases[tc++] = new TestCase( - SECTION, - "new Test_Two(2,7).v", - 2, - new Test_Two(2,7).v ); - - testcases[tc++] = new TestCase( - SECTION, - "new (Function)(\"x\", \"return x+3\")(5,6)", - 8, - new (Function)("x","return x+3")(5,6) ); - - testcases[tc++] = new TestCase( - SECTION, - "new new Test_Two(String, 2).v(0123)", - "83", - new new Test_Two(String, 2).v(0123) +""); - - testcases[tc++] = new TestCase( - SECTION, - "new new Test_Two(String, 2).v(0123).length", - 2, - new new Test_Two(String, 2).v(0123).length ); - - test(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/Script/script-001.js b/JavaScriptCore/tests/mozilla/js1_3/Script/script-001.js deleted file mode 100644 index 5e7ec89..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/Script/script-001.js +++ /dev/null @@ -1,159 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: script-001.js - Section: - Description: new NativeScript object - - -js> parseInt(123,"hi") -123 -js> parseInt(123, "blah") -123 -js> s -js: s is not defined -js> s = new Script - -undefined; - - -js> s = new Script() - -undefined; - - -js> s.getJSClass -js> s.getJSClass = Object.prototype.toString -function toString() { - [native code] -} - -js> s.getJSClass() -[object Script] -js> s.compile( "return 3+4" ) -js: JavaScript exception: javax.javascript.EvaluatorException: "<Scr -js> s.compile( "3+4" ) - -3 + 4; - - -js> typeof s -function -js> s() -Jit failure! -invalid opcode: 1 -Jit Pass1 Failure! -javax/javascript/gen/c13 initScript (Ljavax/javascript/Scriptable;)V -An internal JIT error has occurred. Please report this with .class -jit-bugs@itools.symantec.com - -7 -js> s.compile("3+4") - -3 + 4; - - -js> s() -Jit failure! -invalid opcode: 1 -Jit Pass1 Failure! -javax/javascript/gen/c17 initScript (Ljavax/javascript/Scriptable;)V -An internal JIT error has occurred. Please report this with .class -jit-bugs@itools.symantec.com - -7 -js> quit() - -C:\src\ns_priv\js\tests\ecma>shell - -C:\src\ns_priv\js\tests\ecma>java -classpath c:\cafe\java\JavaScope; -:\src\ns_priv\js\tests javax.javascript.examples.Shell -Symantec Java! JustInTime Compiler Version 210.054 for JDK 1.1.2 -Copyright (C) 1996-97 Symantec Corporation - -js> s = new Script("3+4") - -3 + 4; - - -js> s() -7 -js> s2 = new Script(); - -undefined; - - -js> s.compile( "3+4") - -3 + 4; - - -js> s() -Jit failure! -invalid opcode: 1 -Jit Pass1 Failure! -javax/javascript/gen/c7 initScript (Ljavax/javascript/Scriptable;)V -An internal JIT error has occurred. Please report this with .class -jit-bugs@itools.symantec.com - -7 -js> quit() - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "script-001"; - var VERSION = "JS1_3"; - var TITLE = "NativeScript"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - - var s = new Script(); - s.getJSClass = Object.prototype.toString; - - testcases[tc++] = new TestCase( SECTION, - "var s = new Script(); typeof s", - "function", - typeof s ); - - testcases[tc++] = new TestCase( SECTION, - "s.getJSClass()", - "[object Script]", - s.getJSClass() ); - - test(); -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/Script/switch-001.js b/JavaScriptCore/tests/mozilla/js1_3/Script/switch-001.js deleted file mode 100644 index b3f71d7..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/Script/switch-001.js +++ /dev/null @@ -1,80 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - 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); - - var testcases = new Array(); - - 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"; - } - - testcases[tc++] = new TestCase( - SECTION, - "switch / case should use strict equality in version of JS < 1.4", - "pass", - result ); - - - - test(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_1.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_1.js deleted file mode 100644 index 1d9915e..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_1.js +++ /dev/null @@ -1,166 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_1.js - Section: - Description: new PrototypeObject - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_1"; - var VERSION = "JS1_3"; - var TITLE = "new PrototypeObject"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function Employee () { - this.name = ""; - this.dept = "general"; -} -function Manager () { - this.reports = []; -} -Manager.prototype = new Employee(); - -function WorkerBee () { - this.projects = new Array(); -} -WorkerBee.prototype = new Employee(); - -function SalesPerson () { - this.dept = "sales"; - this.quota = 100; -} -SalesPerson.prototype = new WorkerBee(); - -function Engineer () { - this.dept = "engineering"; - this.machine = ""; -} -Engineer.prototype = new WorkerBee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - var jim = new Employee(); - - testcases[tc++] = new TestCase( SECTION, - "jim = new Employee(); jim.name", - "", - jim.name ); - - - testcases[tc++] = new TestCase( SECTION, - "jim = new Employee(); jim.dept", - "general", - jim.dept ); - - var sally = new Manager(); - - testcases[tc++] = new TestCase( SECTION, - "sally = new Manager(); sally.name", - "", - sally.name ); - testcases[tc++] = new TestCase( SECTION, - "sally = new Manager(); sally.dept", - "general", - sally.dept ); - - testcases[tc++] = new TestCase( SECTION, - "sally = new Manager(); sally.reports.length", - 0, - sally.reports.length ); - - testcases[tc++] = new TestCase( SECTION, - "sally = new Manager(); typeof sally.reports", - "object", - typeof sally.reports ); - - var fred = new SalesPerson(); - - testcases[tc++] = new TestCase( SECTION, - "fred = new SalesPerson(); fred.name", - "", - fred.name ); - - testcases[tc++] = new TestCase( SECTION, - "fred = new SalesPerson(); fred.dept", - "sales", - fred.dept ); - - testcases[tc++] = new TestCase( SECTION, - "fred = new SalesPerson(); fred.quota", - 100, - fred.quota ); - - testcases[tc++] = new TestCase( SECTION, - "fred = new SalesPerson(); fred.projects.length", - 0, - fred.projects.length ); - - var jane = new Engineer(); - - testcases[tc++] = new TestCase( SECTION, - "jane = new Engineer(); jane.name", - "", - jane.name ); - - testcases[tc++] = new TestCase( SECTION, - "jane = new Engineer(); jane.dept", - "engineering", - jane.dept ); - - testcases[tc++] = new TestCase( SECTION, - "jane = new Engineer(); jane.projects.length", - 0, - jane.projects.length ); - - testcases[tc++] = new TestCase( SECTION, - "jane = new Engineer(); jane.machine", - "", - jane.machine ); - - - test();
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_10.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_10.js deleted file mode 100644 index e6d1b9a..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_10.js +++ /dev/null @@ -1,152 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_10.js - Section: - Description: Determining Instance Relationships - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_10"; - var VERSION = "JS1_3"; - var TITLE = "Determining Instance Relationships"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function InstanceOf( object, constructor ) { - while ( object != null ) { - if ( object == constructor.prototype ) { - return true; - } - object = object.__proto__; - } - return false; -} -function Employee ( name, dept ) { - this.name = name || ""; - this.dept = dept || "general"; -} - -function Manager () { - this.reports = []; -} -Manager.prototype = new Employee(); - -function WorkerBee ( name, dept, projs ) { - this.base = Employee; - this.base( name, dept) - this.projects = projs || new Array(); -} -WorkerBee.prototype = new Employee(); - -function SalesPerson () { - this.dept = "sales"; - this.quota = 100; -} -SalesPerson.prototype = new WorkerBee(); - -function Engineer ( name, projs, machine ) { - this.base = WorkerBee; - this.base( name, "engineering", projs ) - this.machine = machine || ""; -} -Engineer.prototype = new WorkerBee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - var pat = new Engineer() - - testcases[tc++] = new TestCase( SECTION, - "pat.__proto__ == Engineer.prototype", - true, - pat.__proto__ == Engineer.prototype ); - - testcases[tc++] = new TestCase( SECTION, - "pat.__proto__.__proto__ == WorkerBee.prototype", - true, - pat.__proto__.__proto__ == WorkerBee.prototype ); - - testcases[tc++] = new TestCase( SECTION, - "pat.__proto__.__proto__.__proto__ == Employee.prototype", - true, - pat.__proto__.__proto__.__proto__ == Employee.prototype ); - - testcases[tc++] = new TestCase( SECTION, - "pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype", - true, - pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype ); - - testcases[tc++] = new TestCase( SECTION, - "pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null", - true, - pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null ); - - - testcases[tc++] = new TestCase( SECTION, - "InstanceOf( pat, Engineer )", - true, - InstanceOf( pat, Engineer ) ); - - testcases[tc++] = new TestCase( SECTION, - "InstanceOf( pat, WorkerBee )", - true, - InstanceOf( pat, WorkerBee ) ); - - testcases[tc++] = new TestCase( SECTION, - "InstanceOf( pat, Employee )", - true, - InstanceOf( pat, Employee ) ); - - testcases[tc++] = new TestCase( SECTION, - "InstanceOf( pat, Object )", - true, - InstanceOf( pat, Object ) ); - - testcases[tc++] = new TestCase( SECTION, - "InstanceOf( pat, SalesPerson )", - false, - InstanceOf ( pat, SalesPerson ) ); - test(); diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_11.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_11.js deleted file mode 100644 index 4e92b9b..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_11.js +++ /dev/null @@ -1,115 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_11.js - Section: - Description: Global Information in Constructors - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_11"; - var VERSION = "JS1_3"; - var TITLE = "Global Information in Constructors"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - var idCounter = 1; - - -function Employee ( name, dept ) { - this.name = name || ""; - this.dept = dept || "general"; - this.id = idCounter++; -} -function Manager () { - this.reports = []; -} -Manager.prototype = new Employee(); - -function WorkerBee ( name, dept, projs ) { - this.base = Employee; - this.base( name, dept) - this.projects = projs || new Array(); -} -WorkerBee.prototype = new Employee(); - -function SalesPerson () { - this.dept = "sales"; - this.quota = 100; -} -SalesPerson.prototype = new WorkerBee(); - -function Engineer ( name, projs, machine ) { - this.base = WorkerBee; - this.base( name, "engineering", projs ) - this.machine = machine || ""; -} -Engineer.prototype = new WorkerBee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - var pat = new Employee( "Toonces, Pat", "Tech Pubs" ) - var terry = new Employee( "O'Sherry Terry", "Marketing" ); - - var les = new Engineer( "Morris, Les", new Array("JavaScript"), "indy" ); - - testcases[tc++] = new TestCase( SECTION, - "pat.id", - 5, - pat.id ); - - testcases[tc++] = new TestCase( SECTION, - "terry.id", - 6, - terry.id ); - - testcases[tc++] = new TestCase( SECTION, - "les.id", - 7, - les.id ); - - - test(); - diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_12.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_12.js deleted file mode 100644 index 93081a0..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_12.js +++ /dev/null @@ -1,142 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_12.js - Section: - Description: new PrototypeObject - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - No Multiple Inheritance - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_12"; - var VERSION = "JS1_3"; - var TITLE = "No Multiple Inheritance"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function Employee ( name, dept ) { - this.name = name || ""; - this.dept = dept || "general"; - this.id = idCounter++; -} -function Manager () { - this.reports = []; -} -Manager.prototype = new Employee(); - -function WorkerBee ( name, dept, projs ) { - this.base = Employee; - this.base( name, dept) - this.projects = projs || new Array(); -} -WorkerBee.prototype = new Employee(); - -function SalesPerson () { - this.dept = "sales"; - this.quota = 100; -} -SalesPerson.prototype = new WorkerBee(); - -function Hobbyist( hobby ) { - this.hobby = hobby || "yodeling"; -} - -function Engineer ( name, projs, machine, hobby ) { - this.base1 = WorkerBee; - this.base1( name, "engineering", projs ) - - this.base2 = Hobbyist; - this.base2( hobby ); - - this.projects = projs || new Array(); - this.machine = machine || ""; -} -Engineer.prototype = new WorkerBee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - var idCounter = 1; - - var les = new Engineer( "Morris, Les", new Array("JavaScript"), "indy" ); - - Hobbyist.prototype.equipment = [ "horn", "mountain", "goat" ]; - - testcases[tc++] = new TestCase( SECTION, - "les.name", - "Morris, Les", - les.name ); - - testcases[tc++] = new TestCase( SECTION, - "les.dept", - "engineering", - les.dept ); - - Array.prototype.getClass = Object.prototype.toString; - - testcases[tc++] = new TestCase( SECTION, - "les.projects.getClass()", - "[object Array]", - les.projects.getClass() ); - - testcases[tc++] = new TestCase( SECTION, - "les.projects[0]", - "JavaScript", - les.projects[0] ); - - testcases[tc++] = new TestCase( SECTION, - "les.machine", - "indy", - les.machine ); - - testcases[tc++] = new TestCase( SECTION, - "les.hobby", - "yodeling", - les.hobby ); - - testcases[tc++] = new TestCase( SECTION, - "les.equpment", - void 0, - les.equipment ); - - test(); diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_2.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_2.js deleted file mode 100644 index 1300ed3..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_2.js +++ /dev/null @@ -1,122 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_2.js - Section: - Description: new PrototypeObject - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_2"; - var VERSION = "JS1_3"; - var TITLE = "new PrototypeObject"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function Employee () { - this.name = ""; - this.dept = "general"; -} -function Manager () { - this.reports = []; -} -Manager.prototype = new Employee(); - -function WorkerBee () { - this.projects = new Array(); -} - -WorkerBee.prototype = new Employee; - -function SalesPerson () { - this.dept = "sales"; - this.quota = 100; -} -SalesPerson.prototype = new WorkerBee; - -function Engineer () { - this.dept = "engineering"; - this.machine = ""; -} -Engineer.prototype = new WorkerBee; - - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - - var employee = new Employee(); - var manager = new Manager(); - var workerbee = new WorkerBee(); - var salesperson = new SalesPerson(); - var engineer = new Engineer(); - - testcases[tc++] = new TestCase( SECTION, - "employee.__proto__ == Employee.prototype", - true, - employee.__proto__ == Employee.prototype ); - - testcases[tc++] = new TestCase( SECTION, - "manager.__proto__ == Manager.prototype", - true, - manager.__proto__ == Manager.prototype ); - - testcases[tc++] = new TestCase( SECTION, - "workerbee.__proto__ == WorkerBee.prototype", - true, - workerbee.__proto__ == WorkerBee.prototype ); - - testcases[tc++] = new TestCase( SECTION, - "salesperson.__proto__ == SalesPerson.prototype", - true, - salesperson.__proto__ == SalesPerson.prototype ); - - testcases[tc++] = new TestCase( SECTION, - "engineer.__proto__ == Engineer.prototype", - true, - engineer.__proto__ == Engineer.prototype ); - - test(); - diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_3.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_3.js deleted file mode 100644 index 61fa033..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_3.js +++ /dev/null @@ -1,103 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_3.js - Section: - Description: Adding properties to an instance - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_3"; - var VERSION = "JS1_3"; - var TITLE = "Adding properties to an Instance"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function Employee () { - this.name = ""; - this.dept = "general"; -} -function Manager () { - this.reports = []; -} -Manager.prototype = new Employee(); - -function WorkerBee () { - this.projects = new Array(); -} - -WorkerBee.prototype = new Employee(); - -function SalesPerson () { - this.dept = "sales"; - this.quota = 100; -} -SalesPerson.prototype = new WorkerBee(); - -function Engineer () { - this.dept = "engineering"; - this.machine = ""; -} -Engineer.prototype = new WorkerBee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - var jim = new Employee(); - var pat = new Employee(); - - jim.bonus = 300; - - testcases[tc++] = new TestCase( SECTION, - "jim = new Employee(); jim.bonus = 300; jim.bonus", - 300, - jim.bonus ); - - - testcases[tc++] = new TestCase( SECTION, - "pat = new Employee(); pat.bonus", - void 0, - pat.bonus ); - test(); diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_4.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_4.js deleted file mode 100644 index 2006f76..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_4.js +++ /dev/null @@ -1,156 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_4.js - Section: - Description: new PrototypeObject - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - If you add a property to an object in the prototype chain, instances of - objects that derive from that prototype should inherit that property, even - if they were instatiated after the property was added to the prototype object. - - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_3"; - var VERSION = "JS1_3"; - var TITLE = "Adding properties to the prototype"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function Employee () { - this.name = ""; - this.dept = "general"; -} -function Manager () { - this.reports = []; -} -Manager.prototype = new Employee(); - -function WorkerBee () { - this.projects = new Array(); -} - -WorkerBee.prototype = new Employee(); - -function SalesPerson () { - this.dept = "sales"; - this.quota = 100; -} -SalesPerson.prototype = new WorkerBee(); - -function Engineer () { - this.dept = "engineering"; - this.machine = ""; -} -Engineer.prototype = new WorkerBee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - - var jim = new Employee(); - var terry = new Engineer(); - var sean = new SalesPerson(); - var wally = new Manager(); - - Employee.prototype.specialty = "none"; - - var pat = new Employee(); - var leslie = new Engineer(); - var bubbles = new SalesPerson(); - var furry = new Manager(); - - Engineer.prototype.specialty = "code"; - - var chris = new Engineer(); - - - testcases[tc++] = new TestCase( SECTION, - "jim = new Employee(); jim.specialty", - "none", - jim.specialty ); - - testcases[tc++] = new TestCase( SECTION, - "terry = new Engineer(); terry.specialty", - "code", - terry.specialty ); - - testcases[tc++] = new TestCase( SECTION, - "sean = new SalesPerson(); sean.specialty", - "none", - sean.specialty ); - - testcases[tc++] = new TestCase( SECTION, - "wally = new Manager(); wally.specialty", - "none", - wally.specialty ); - - testcases[tc++] = new TestCase( SECTION, - "furry = new Manager(); furry.specialty", - "none", - furry.specialty ); - - testcases[tc++] = new TestCase( SECTION, - "pat = new Employee(); pat.specialty", - "none", - pat.specialty ); - - testcases[tc++] = new TestCase( SECTION, - "leslie = new Engineer(); leslie.specialty", - "code", - leslie.specialty ); - - testcases[tc++] = new TestCase( SECTION, - "bubbles = new SalesPerson(); bubbles.specialty", - "none", - bubbles.specialty ); - - - testcases[tc++] = new TestCase( SECTION, - "chris = new Employee(); chris.specialty", - "code", - chris.specialty ); - test(); diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_5.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_5.js deleted file mode 100644 index 4c84d33..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_5.js +++ /dev/null @@ -1,146 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_5.js - Section: - Description: Logical OR || in Constructors - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - This tests the logical OR opererator || syntax in constructors. - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_5"; - var VERSION = "JS1_3"; - var TITLE = "Logical OR || in Constructors"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function Employee ( name, dept ) { - this.name = name || ""; - this.dept = dept || "general"; -} -function Manager () { - this.reports = []; -} -Manager.prototype = new Employee(); - -function WorkerBee ( projs ) { - this.projects = projs || new Array(); -} -WorkerBee.prototype = new Employee(); - -function SalesPerson () { - this.dept = "sales"; - this.quota = 100; -} -SalesPerson.prototype = new WorkerBee(); - -function Engineer ( machine ) { - this.dept = "engineering"; - this.machine = machine || ""; -} -Engineer.prototype = new WorkerBee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - - - var pat = new Engineer( "indy" ); - - var les = new Engineer(); - - testcases[tc++] = new TestCase( SECTION, - "var pat = new Engineer(\"indy\"); pat.name", - "", - pat.name ); - - testcases[tc++] = new TestCase( SECTION, - "pat.dept", - "engineering", - pat.dept ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects.length", - 0, - pat.projects.length ); - - testcases[tc++] = new TestCase( SECTION, - "pat.machine", - "indy", - pat.machine ); - - testcases[tc++] = new TestCase( SECTION, - "pat.__proto__ == Engineer.prototype", - true, - pat.__proto__ == Engineer.prototype ); - - testcases[tc++] = new TestCase( SECTION, - "var les = new Engineer(); les.name", - "", - les.name ); - - testcases[tc++] = new TestCase( SECTION, - "les.dept", - "engineering", - les.dept ); - - testcases[tc++] = new TestCase( SECTION, - "les.projects.length", - 0, - les.projects.length ); - - testcases[tc++] = new TestCase( SECTION, - "les.machine", - "", - les.machine ); - - testcases[tc++] = new TestCase( SECTION, - "les.__proto__ == Engineer.prototype", - true, - les.__proto__ == Engineer.prototype ); - - - test();
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_6.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_6.js deleted file mode 100644 index 15d4bdd..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_6.js +++ /dev/null @@ -1,171 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_6.js - Section: - Description: Logical OR || in constructors - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - This tests the logical OR opererator || syntax in constructors. - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_6"; - var VERSION = "JS1_3"; - var TITLE = "Logical OR || in constructors"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function Employee ( name, dept ) { - this.name = name || ""; - this.dept = dept || "general"; -} -function Manager () { - this.reports = []; -} -Manager.prototype = new Employee(); - -function WorkerBee ( name, dept, projs ) { - this.base = Employee; - this.base( name, dept) - this.projects = projs || new Array(); -} - -WorkerBee.prototype = new Employee(); - -function SalesPerson () { - this.dept = "sales"; - this.quota = 100; -} -SalesPerson.prototype = new WorkerBee(); - -function Engineer ( name, projs, machine ) { - this.base = WorkerBee; - this.base( name, "engineering", projs ) - this.machine = machine || ""; -} -Engineer.prototype = new WorkerBee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - - var pat = new Engineer( "Toonces, Pat", - ["SpiderMonkey", "Rhino"], - "indy" ); - - var les = new WorkerBee( "Morris, Les", - "Training", - ["Hippo"] ) - - var terry = new Employee( "Boomberi, Terry", - "Marketing" ); - - // Pat, the Engineer - - testcases[tc++] = new TestCase( SECTION, - "pat.name", - "Toonces, Pat", - pat.name ); - - testcases[tc++] = new TestCase( SECTION, - "pat.dept", - "engineering", - pat.dept ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects.length", - 2, - pat.projects.length ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects[0]", - "SpiderMonkey", - pat.projects[0] ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects[1]", - "Rhino", - pat.projects[1] ); - - testcases[tc++] = new TestCase( SECTION, - "pat.machine", - "indy", - pat.machine ); - - - // Les, the WorkerBee - - testcases[tc++] = new TestCase( SECTION, - "les.name", - "Morris, Les", - les.name ); - - testcases[tc++] = new TestCase( SECTION, - "les.dept", - "Training", - les.dept ); - - testcases[tc++] = new TestCase( SECTION, - "les.projects.length", - 1, - les.projects.length ); - - testcases[tc++] = new TestCase( SECTION, - "les.projects[0]", - "Hippo", - les.projects[0] ); - - // Terry, the Employee - testcases[tc++] = new TestCase( SECTION, - "terry.name", - "Boomberi, Terry", - terry.name ); - - testcases[tc++] = new TestCase( SECTION, - "terry.dept", - "Marketing", - terry.dept ); - test(); - diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_7.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_7.js deleted file mode 100644 index 207fa17..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_7.js +++ /dev/null @@ -1,125 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_7.js - Section: - Description: Adding Properties to the Prototype Object - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - This tests - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_6"; - var VERSION = "JS1_3"; - var TITLE = "Adding properties to the Prototype Object"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function Employee ( name, dept ) { - this.name = name || ""; - this.dept = dept || "general"; -} -function WorkerBee ( name, dept, projs ) { - this.base = Employee; - this.base( name, dept) - this.projects = projs || new Array(); -} -WorkerBee.prototype = new Employee(); - -function Engineer ( name, projs, machine ) { - this.base = WorkerBee; - this.base( name, "engineering", projs ) - this.machine = machine || ""; -} -// Engineer.prototype = new WorkerBee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - var pat = new Engineer( "Toonces, Pat", - ["SpiderMonkey", "Rhino"], - "indy" ); - - Employee.prototype.specialty = "none"; - - - // Pat, the Engineer - - testcases[tc++] = new TestCase( SECTION, - "pat.name", - "Toonces, Pat", - pat.name ); - - testcases[tc++] = new TestCase( SECTION, - "pat.dept", - "engineering", - pat.dept ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects.length", - 2, - pat.projects.length ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects[0]", - "SpiderMonkey", - pat.projects[0] ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects[1]", - "Rhino", - pat.projects[1] ); - - testcases[tc++] = new TestCase( SECTION, - "pat.machine", - "indy", - pat.machine ); - - testcases[tc++] = new TestCase( SECTION, - "pat.specialty", - void 0, - pat.specialty ); - - test(); diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_8.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_8.js deleted file mode 100644 index fa92d70..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_8.js +++ /dev/null @@ -1,123 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_8.js - Section: - Description: Adding Properties to the Prototype Object - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_8"; - var VERSION = "JS1_3"; - var TITLE = "Adding Properties to the Prototype Object"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function Employee ( name, dept ) { - this.name = name || ""; - this.dept = dept || "general"; -} -function WorkerBee ( name, dept, projs ) { - this.base = Employee; - this.base( name, dept) - this.projects = projs || new Array(); -} -WorkerBee.prototype = new Employee(); - -function Engineer ( name, projs, machine ) { - this.base = WorkerBee; - this.base( name, "engineering", projs ) - this.machine = machine || ""; -} -Engineer.prototype = new WorkerBee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - var pat = new Engineer( "Toonces, Pat", - ["SpiderMonkey", "Rhino"], - "indy" ); - - Employee.prototype.specialty = "none"; - - - // Pat, the Engineer - - testcases[tc++] = new TestCase( SECTION, - "pat.name", - "Toonces, Pat", - pat.name ); - - testcases[tc++] = new TestCase( SECTION, - "pat.dept", - "engineering", - pat.dept ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects.length", - 2, - pat.projects.length ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects[0]", - "SpiderMonkey", - pat.projects[0] ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects[1]", - "Rhino", - pat.projects[1] ); - - testcases[tc++] = new TestCase( SECTION, - "pat.machine", - "indy", - pat.machine ); - - testcases[tc++] = new TestCase( SECTION, - "pat.specialty", - "none", - pat.specialty ); - - test(); diff --git a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_9.js b/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_9.js deleted file mode 100644 index 93989ca..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_9.js +++ /dev/null @@ -1,101 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - File Name: proto_9.js - Section: - Description: Local versus Inherited Values - - This tests Object Hierarchy and Inheritance, as described in the document - Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 - 15:19:34 on http://devedge.netscape.com/. Current URL: - http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm - - This tests the syntax ObjectName.prototype = new PrototypeObject using the - Employee example in the document referenced above. - - This tests - - Author: christine@netscape.com - Date: 12 november 1997 -*/ - - var SECTION = "proto_9"; - var VERSION = "JS1_3"; - var TITLE = "Local versus Inherited Values"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - -function Employee ( name, dept ) { - this.name = name || ""; - this.dept = dept || "general"; -} -function WorkerBee ( name, dept, projs ) { - this.projects = new Array(); -} -WorkerBee.prototype = new Employee(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - var pat = new WorkerBee() - - Employee.prototype.specialty = "none"; - Employee.prototype.name = "Unknown"; - - Array.prototype.getClass = Object.prototype.toString; - - // Pat, the WorkerBee - - testcases[tc++] = new TestCase( SECTION, - "pat.name", - "", - pat.name ); - - testcases[tc++] = new TestCase( SECTION, - "pat.dept", - "general", - pat.dept ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects.getClass", - "[object Array]", - pat.projects.getClass() ); - - testcases[tc++] = new TestCase( SECTION, - "pat.projects.length", - 0, - pat.projects.length ); - - test();
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/js1_3/jsref.js b/JavaScriptCore/tests/mozilla/js1_3/jsref.js deleted file mode 100644 index dd611a7..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/jsref.js +++ /dev/null @@ -1,198 +0,0 @@ -var completed = false; -var testcases; - -SECTION = ""; -VERSION = ""; - -BUGNUMBER =""; -var EXCLUDE = ""; - -TZ_DIFF = -8; - -var TT = ""; -var TT_ = ""; -var BR = ""; -var NBSP = " "; -var CR = "\n"; -var FONT = ""; -var FONT_ = ""; -var FONT_RED = ""; -var FONT_GREEN = ""; -var B = ""; -var B_ = "" -var H2 = ""; -var H2_ = ""; -var HR = ""; -var DEBUG = false; - -version(130); - -var PASSED = " PASSED!" -var FAILED = " FAILED! expected: "; - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - -function TestCase( n, d, e, a ) { - this.name = n; - this.description = d; - this.expect = e; - this.actual = a; - this.passed = true; - this.reason = ""; - - this.bugnumber = BUGNUMBER; - - this.passed = getTestCaseResult( this.expect, this.actual ); - if ( DEBUG ) { - writeLineToLog( "added " + this.description ); - } -} -function startTest() { - // JavaScript 1.3 is supposed to be compliant ecma version 1.0 - if ( VERSION == "ECMA_1" ) { - version ( "130" ); - } - if ( VERSION == "JS_1.3" ) { - version ( "130" ); - } - if ( VERSION == "JS_1.2" ) { - version ( "120" ); - } - if ( VERSION == "JS_1.1" ) { - version ( "110" ); - } - // for ecma version 2.0, we will leave the javascript version to - // the default ( for now ). -} -function getTestCaseResult( expect, actual ) { - // because ( NaN == NaN ) always returns false, need to do - // a special compare to see if we got the right result. - if ( actual != actual ) { - if ( typeof actual == "object" ) { - actual = "NaN object"; - } else { - actual = "NaN number"; - } - } - if ( expect != expect ) { - if ( typeof expect == "object" ) { - expect = "NaN object"; - } else { - expect = "NaN number"; - } - } - - var passed = ( expect == actual ) ? true : false; - - // if both objects are numbers - // need to replace w/ IEEE standard for rounding - if ( !passed - && typeof(actual) == "number" - && typeof(expect) == "number" - ) { - if ( Math.abs(actual-expect) < 0.0000001 ) { - passed = true; - } - } - - // verify type is the same - if ( typeof(expect) != typeof(actual) ) { - passed = false; - } - - return passed; -} -function writeTestCaseResult( expect, actual, string ) { - var passed = getTestCaseResult( expect, actual ); - writeFormattedResult( expect, actual, string, passed ); - return passed; -} -function writeFormattedResult( expect, actual, string, passed ) { - var s = TT + string ; - - for ( k = 0; - k < (60 - string.length >= 0 ? 60 - string.length : 5) ; - k++ ) { - } - - s += B ; - s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; - - writeLineToLog( s + FONT_ + B_ + TT_ ); - - return passed; -} - -function writeLineToLog( string ) { - print( string + BR + CR ); -} -function writeHeaderToLog( string ) { - print( H2 + string + H2_ ); -} -function stopTest() -{ - var sizeTag = "<#TEST CASES SIZE>"; - var doneTag = "<#TEST CASES DONE>"; - var beginTag = "<#TEST CASE "; - var endTag = ">"; - - print(sizeTag); - print(testcases.length); - for (tc = 0; tc < testcases.length; tc++) - { - print(beginTag + 'PASSED' + endTag); - print(testcases[tc].passed); - print(beginTag + 'NAME' + endTag); - print(testcases[tc].name); - print(beginTag + 'EXPECTED' + endTag); - print(testcases[tc].expect); - print(beginTag + 'ACTUAL' + endTag); - print(testcases[tc].actual); - print(beginTag + 'DESCRIPTION' + endTag); - print(testcases[tc].description); - print(beginTag + 'REASON' + endTag); - print(( testcases[tc].passed ) ? "" : "wrong value "); - print(beginTag + 'BUGNUMBER' + endTag); - print( BUGNUMBER ); - } - print(doneTag); - - print( HR ); - gc(); -} -function getFailedCases() { - for ( var i = 0; i < testcases.length; i++ ) { - if ( ! testcases[i].passed ) { - print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); - } - } -} -function err( msg, page, line ) { - testcases[tc].actual = "error"; - testcases[tc].reason = msg; - writeTestCaseResult( testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ testcases[tc].actual + - ": " + testcases[tc].reason ); - stopTest(); - return true; -} - -function Enumerate ( o ) { - var p; - for ( p in o ) { - writeLineToLog( p +": " + o[p] ); - } -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/regress/delete-001.js b/JavaScriptCore/tests/mozilla/js1_3/regress/delete-001.js deleted file mode 100644 index e2f4332..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/regress/delete-001.js +++ /dev/null @@ -1,79 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - 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 statment"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var testcases = new Array(); - - // 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 - - testcases[testcases.length] = new TestCase( SECTION, - "delete all properties of the global object", - "PASSED", - result == "" ? "FAILED" : "PASSED" ); - - - test(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/regress/function-001-n.js b/JavaScriptCore/tests/mozilla/js1_3/regress/function-001-n.js deleted file mode 100644 index 5b4add0..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/regress/function-001-n.js +++ /dev/null @@ -1,74 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - * 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); - - var testcases = new Array(); - - testcases[tc++] = new TestCase( - SECTION, - "eval(\"function f(){}function g(){}\")", - "error", - eval("function f(){}function g(){}") ); - - test(); - - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/regress/function-002.js b/JavaScriptCore/tests/mozilla/js1_3/regress/function-002.js deleted file mode 100644 index d3d1d85..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/regress/function-002.js +++ /dev/null @@ -1,75 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - 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); - - var testcases = new Array(); - - testcases[tc++] = new TestCase( - SECTION, - "0?function(){}:0", - 0, - 0?function(){}:0 ); - - - bar = true; - foo = bar ? function () { return true; } : function() { return false; }; - - testcases[tc++] = new TestCase( - SECTION, - "bar = true; foo = bar ? function () { return true; } : function() { return false; }; foo()", - true, - foo() ); - - - test(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/regress/in-001.js b/JavaScriptCore/tests/mozilla/js1_3/regress/in-001.js deleted file mode 100644 index f524870..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/regress/in-001.js +++ /dev/null @@ -1,66 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - 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); - - var testcases = new Array(); - - o = {}; - o.foo = 'sil'; - - testcases[tc++] = new TestCase( - SECTION, - "\"foo\" in o", - true, - "foo" in o ); - - test(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/regress/new-001.js b/JavaScriptCore/tests/mozilla/js1_3/regress/new-001.js deleted file mode 100644 index 2868eca..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/regress/new-001.js +++ /dev/null @@ -1,120 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - 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); - - var testcases = new Array(); - - function Test_One (x) { - this.v = x+1; - return x*2 - } - - function Test_Two( x, y ) { - this.v = x; - return y; - } - - testcases[tc++] = new TestCase( - SECTION, - "Test_One(18)", - 36, - Test_One(18) ); - - testcases[tc++] = new TestCase( - SECTION, - "new Test_One(18)", - "[object Object]", - new Test_One(18) +"" ); - - testcases[tc++] = new TestCase( - SECTION, - "new Test_One(18).v", - 19, - new Test_One(18).v ); - - testcases[tc++] = new TestCase( - SECTION, - "Test_Two(2,7)", - 7, - Test_Two(2,7) ); - - testcases[tc++] = new TestCase( - SECTION, - "new Test_Two(2,7)", - "[object Object]", - new Test_Two(2,7) +"" ); - - testcases[tc++] = new TestCase( - SECTION, - "new Test_Two(2,7).v", - 2, - new Test_Two(2,7).v ); - - testcases[tc++] = new TestCase( - SECTION, - "new (Function)(\"x\", \"return x+3\")(5,6)", - 8, - new (Function)("x","return x+3")(5,6) ); - - testcases[tc++] = new TestCase( - SECTION, - "new new Test_Two(String, 2).v(0123)", - "83", - new new Test_Two(String, 2).v(0123) +""); - - testcases[tc++] = new TestCase( - SECTION, - "new new Test_Two(String, 2).v(0123).length", - 2, - new new Test_Two(String, 2).v(0123).length ); - - test(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/regress/switch-001.js b/JavaScriptCore/tests/mozilla/js1_3/regress/switch-001.js deleted file mode 100644 index 47d8a44..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/regress/switch-001.js +++ /dev/null @@ -1,80 +0,0 @@ -/* The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - */ -/** - 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. It's now been decided that - we won't put in version switches, so all switches will - be ECMA. - - 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); - - var testcases = new Array(); - - result = "fail: did not enter switch"; - - switch (true) { - case 1: - result = "fail: version 130 should force strict equality"; - break; - case true: - result = "pass"; - break; - default: - result = "fail: evaluated default statement"; - } - - testcases[tc++] = new TestCase( - SECTION, - "switch / case should use strict equality in version of JS < 1.4", - "pass", - result ); - - test(); - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/shell.js b/JavaScriptCore/tests/mozilla/js1_3/shell.js deleted file mode 100644 index dc0ec4e..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/shell.js +++ /dev/null @@ -1,163 +0,0 @@ -var completed = false; -var testcases; -var tc = 0; - -SECTION = ""; -VERSION = ""; -BUGNUMBER = ""; -DEBUG = false; - -var GLOBAL = "[object global]"; -var PASSED = " PASSED!" -var FAILED = " FAILED! expected: "; - -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} - -/* wrapper for test cas constructor that doesn't require the SECTION - * argument. - */ - -function AddTestCase( description, expect, actual ) { - testcases[tc++] = new TestCase( SECTION, description, expect, actual ); -} - -function TestCase( n, d, e, a ) { - this.name = n; - this.description = d; - this.expect = e; - this.actual = a; - this.passed = true; - this.reason = ""; - this.bugnumber = BUGNUMBER; - - this.passed = getTestCaseResult( this.expect, this.actual ); - if ( DEBUG ) { - writeLineToLog( "added " + this.description ); - } -} -function startTest() { - // JavaScript 1.3 is supposed to be compliant ecma version 1.0 - if ( VERSION == "ECMA_1" ) { - version ( 130 ); - } - if ( VERSION == "JS_1.3" ) { - version ( 130 ); - } - if ( VERSION == "JS_1.2" ) { - version ( 120 ); - } - if ( VERSION == "JS_1.1" ) { - version ( 110 ); - } - // for ecma version 2.0, we will leave the javascript version to - // the default ( for now ). - - if ( BUGNUMBER ) { - writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); - } - - testcases = new Array(); - tc = 0; -} -function getTestCaseResult( expect, actual ) { - // because ( NaN == NaN ) always returns false, need to do - // a special compare to see if we got the right result. - if ( actual != actual ) { - if ( typeof actual == "object" ) { - actual = "NaN object"; - } else { - actual = "NaN number"; - } - } - if ( expect != expect ) { - if ( typeof expect == "object" ) { - expect = "NaN object"; - } else { - expect = "NaN number"; - } - } - - var passed = ( expect == actual ) ? true : false; - - // if both objects are numbers - // need to replace w/ IEEE standard for rounding - if ( !passed - && typeof(actual) == "number" - && typeof(expect) == "number" - ) { - if ( Math.abs(actual-expect) < 0.0000001 ) { - passed = true; - } - } - - // verify type is the same - if ( typeof(expect) != typeof(actual) ) { - passed = false; - } - - return passed; -} -function writeTestCaseResult( expect, actual, string ) { - var passed = getTestCaseResult( expect, actual ); - writeFormattedResult( expect, actual, string, passed ); - return passed; -} -function writeFormattedResult( expect, actual, string, passed ) { - var s = TT + string ; - - for ( k = 0; - k < (60 - string.length >= 0 ? 60 - string.length : 5) ; - k++ ) { - } - - s += B ; - s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; - - writeLineToLog( s + FONT_ + B_ + TT_ ); - - return passed; -} -/* - * Begin printing functions. These functions use the shell's - * print function. When running tests in the browser, these - * functions, override these functions with functions that use - * document.write. - */ - -function writeTestCaseResult( expect, actual, string ) { - var passed = getTestCaseResult( expect, actual ); - writeFormattedResult( expect, actual, string, passed ); - return passed; -} -function writeFormattedResult( expect, actual, string, passed ) { - var s = string ; - s += ( passed ) ? PASSED : FAILED + expect; - writeLineToLog( s); - return passed; -} -function writeLineToLog( string ) { - print( string ); -} -function writeHeaderToLog( string ) { - print( string ); -} -/* end of print functions */ - -function stopTest() { - var gc; - if ( gc != undefined ) { - gc(); - } -} diff --git a/JavaScriptCore/tests/mozilla/js1_3/template.js b/JavaScriptCore/tests/mozilla/js1_3/template.js deleted file mode 100644 index 1958832..0000000 --- a/JavaScriptCore/tests/mozilla/js1_3/template.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - File Name: switch_1.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 -*/ -// onerror = err; - - var SECTION = "script_1; - var VERSION = "JS1_3"; - var TITLE = "NativeScript"; - var BUGNUMBER="31567"; - - startTest(); - writeHeaderToLog( SECTION + " "+ TITLE); - - var tc = 0; - var testcases = new Array(); - - - testcases[tc++] = new TestCase( SECTION, - - - test(); -function test() { - for ( tc=0; tc < testcases.length; tc++ ) { - testcases[tc].passed = writeTestCaseResult( - testcases[tc].expect, - testcases[tc].actual, - testcases[tc].description +" = "+ - testcases[tc].actual ); - - testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; - } - stopTest(); - return ( testcases ); -} |