1/* 2* The contents of this file are subject to the Netscape Public 3* License Version 1.1 (the "License"); you may not use this file 4* except in compliance with the License. You may obtain a copy of 5* the License at http://www.mozilla.org/NPL/ 6* 7* Software distributed under the License is distributed on an "AS 8* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 9* implied. See the License for the specific language governing 10* rights and limitations under the License. 11* 12* The Original Code is mozilla.org code. 13* 14* The Initial Developer of the Original Code is Netscape 15* Communications 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: regress-7703.js 24 * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=7703"; 25 * Description: See the text of the bugnumber above 26 */ 27 28 var SECTION = "js1_2"; // provide a document reference (ie, ECMA section) 29 var VERSION = "JS1_2"; // Version of JavaScript or ECMA 30 var TITLE = "Regression test for bugzilla # 7703"; // Provide ECMA section title or a description 31 var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7703"; // Provide URL to bugsplat or bugzilla report 32 33 startTest(); // leave this alone 34 35 /* 36 * Calls to AddTestCase here. AddTestCase is a function that is defined 37 * in shell.js and takes three arguments: 38 * - a string representation of what is being tested 39 * - the expected result 40 * - the actual result 41 * 42 * For example, a test might look like this: 43 * 44 * var zip = /[\d]{5}$/; 45 * 46 * AddTestCase( 47 * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test 48 * "02134", // expected result 49 * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result 50 * 51 */ 52 53 types = []; 54 function inspect(object) { 55 for (prop in object) { 56 var x = object[prop]; 57 types[types.length] = (typeof x); 58 } 59 } 60 61 var o = {a: 1, b: 2}; 62 inspect(o); 63 64 AddTestCase( "inspect(o),length", 2, types.length ); 65 AddTestCase( "inspect(o)[0]", "number", types[0] ); 66 AddTestCase( "inspect(o)[1]", "number", types[1] ); 67 68 types_2 = []; 69 70 function inspect_again(object) { 71 for (prop in object) { 72 types_2[types_2.length] = (typeof object[prop]); 73 } 74 } 75 76 inspect_again(o); 77 AddTestCase( "inspect_again(o),length", 2, types.length ); 78 AddTestCase( "inspect_again(o)[0]", "number", types[0] ); 79 AddTestCase( "inspect_again(o)[1]", "number", types[1] ); 80 81 82 test(); // leave this alone. this executes the test cases and 83 // displays results. 84