Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | |
michael@0 | 8 | /** |
michael@0 | 9 | * File Name: regress-7703.js |
michael@0 | 10 | * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=7703"; |
michael@0 | 11 | * Description: See the text of the bugnumber above |
michael@0 | 12 | */ |
michael@0 | 13 | |
michael@0 | 14 | var SECTION = "js1_2"; // provide a document reference (ie, ECMA section) |
michael@0 | 15 | var VERSION = "JS1_2"; // Version of JavaScript or ECMA |
michael@0 | 16 | var TITLE = "Regression test for bugzilla # 7703"; // Provide ECMA section title or a description |
michael@0 | 17 | var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7703"; // Provide URL to bugsplat or bugzilla report |
michael@0 | 18 | |
michael@0 | 19 | startTest(); // leave this alone |
michael@0 | 20 | |
michael@0 | 21 | /* |
michael@0 | 22 | * Calls to AddTestCase here. AddTestCase is a function that is defined |
michael@0 | 23 | * in shell.js and takes three arguments: |
michael@0 | 24 | * - a string representation of what is being tested |
michael@0 | 25 | * - the expected result |
michael@0 | 26 | * - the actual result |
michael@0 | 27 | * |
michael@0 | 28 | * For example, a test might look like this: |
michael@0 | 29 | * |
michael@0 | 30 | * var zip = /[\d]{5}$/; |
michael@0 | 31 | * |
michael@0 | 32 | * AddTestCase( |
michael@0 | 33 | * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test |
michael@0 | 34 | * "02134", // expected result |
michael@0 | 35 | * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result |
michael@0 | 36 | * |
michael@0 | 37 | */ |
michael@0 | 38 | |
michael@0 | 39 | types = []; |
michael@0 | 40 | function inspect(object) { |
michael@0 | 41 | for (prop in object) { |
michael@0 | 42 | var x = object[prop]; |
michael@0 | 43 | types[types.length] = (typeof x); |
michael@0 | 44 | } |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | var o = {a: 1, b: 2}; |
michael@0 | 48 | inspect(o); |
michael@0 | 49 | |
michael@0 | 50 | AddTestCase( "inspect(o),length", 2, types.length ); |
michael@0 | 51 | AddTestCase( "inspect(o)[0]", "number", types[0] ); |
michael@0 | 52 | AddTestCase( "inspect(o)[1]", "number", types[1] ); |
michael@0 | 53 | |
michael@0 | 54 | types_2 = []; |
michael@0 | 55 | |
michael@0 | 56 | function inspect_again(object) { |
michael@0 | 57 | for (prop in object) { |
michael@0 | 58 | types_2[types_2.length] = (typeof object[prop]); |
michael@0 | 59 | } |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | inspect_again(o); |
michael@0 | 63 | AddTestCase( "inspect_again(o),length", 2, types.length ); |
michael@0 | 64 | AddTestCase( "inspect_again(o)[0]", "number", types[0] ); |
michael@0 | 65 | AddTestCase( "inspect_again(o)[1]", "number", types[1] ); |
michael@0 | 66 | |
michael@0 | 67 | |
michael@0 | 68 | test(); // leave this alone. this executes the test cases and |
michael@0 | 69 | // displays results. |