1/* The contents of this file are subject to the Netscape Public 2 * License Version 1.1 (the "License"); you may not use this file 3 * except in compliance with the License. You may obtain a copy of 4 * the License at http://www.mozilla.org/NPL/ 5 * 6 * Software distributed under the License is distributed on an "AS 7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 8 * implied. See the License for the specific language governing 9 * rights and limitations under the License. 10 * 11 * The Original Code is Mozilla Communicator client code, released March 12 * 31, 1998. 13 * 14 * The Initial Developer of the Original Code is Netscape Communications 15 * Corporation. Portions created by Netscape are 16 * Copyright (C) 1998 Netscape Communications Corporation. All 17 * Rights Reserved. 18 * 19 * Contributor(s): 20 * 21 */ 22/** 23 File Name: tostring_2.js 24 Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=114564 25 Description: toString in version 120 26 27 28 Author: christine@netscape.com 29 Date: 15 June 1998 30*/ 31 32 var SECTION = "Array/tostring_2.js"; 33 var VERSION = "JS_12"; 34 startTest(); 35 var TITLE = "Array.toString"; 36 37 writeHeaderToLog( SECTION + " "+ TITLE); 38 39 var testcases = new Array(); 40 41 var a = []; 42 43 var VERSION = 0; 44 45 /* This test assumes that if version() exists, it can set the JavaScript 46 * interpreter to an arbitrary version. To prevent unhandled exceptions in 47 * other tests, jsc implements version() as a stub function, but 48 * JavaScriptCore doesn't support setting the JavaScript engine's version. 49 50 * Commenting out the following lines forces the test to expect JavaScript 51 * 1.5 results. 52 53 * If JavaScriptCore changes to support versioning, this test should split 54 * into a 1.2 test in js1_2/ and a 1.5 test in js1_5/. 55 */ 56 57 /* 58 if ( typeof version == "function" ) { 59 writeLineToLog("version 120"); 60 version(120); 61 VERSION = "120"; 62 } else { 63 function version() { return 0; }; 64 } 65 */ 66 67 testcases[tc++] = new TestCase ( SECTION, 68 "a.toString()", 69 ( VERSION == "120" ? "[]" : "" ), 70 a.toString() ); 71 72 testcases[tc++] = new TestCase ( SECTION, 73 "String( a )", 74 ( VERSION == "120" ? "[]" : "" ), 75 String( a ) ); 76 77 testcases[tc++] = new TestCase ( SECTION, 78 "a +''", 79 ( VERSION == "120" ? "[]" : "" ), 80 a+"" ); 81 82 test(); 83 84function test() { 85 for ( tc=0; tc < testcases.length; tc++ ) { 86 testcases[tc].passed = writeTestCaseResult( 87 testcases[tc].expect, 88 testcases[tc].actual, 89 testcases[tc].description +" = "+ 90 testcases[tc].actual ); 91 92 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; 93 } 94 stopTest(); 95 return ( testcases ); 96} 97