|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 |
|
7 /** |
|
8 * File Name: regress-7635.js |
|
9 * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=7635 |
|
10 * Description: instanceof tweaks |
|
11 * Author: |
|
12 */ |
|
13 |
|
14 var SECTION = "instanceof"; // provide a document reference (ie, ECMA section) |
|
15 var VERSION = "ECMA_2"; // Version of JavaScript or ECMA |
|
16 var TITLE = "Regression test for Bugzilla #7635"; // Provide ECMA section title or a description |
|
17 var BUGNUMBER = "7635"; // Provide URL to bugsplat or bugzilla report |
|
18 |
|
19 startTest(); // leave this alone |
|
20 |
|
21 /* |
|
22 * Calls to AddTestCase here. AddTestCase is a function that is defined |
|
23 * in shell.js and takes three arguments: |
|
24 * - a string representation of what is being tested |
|
25 * - the expected result |
|
26 * - the actual result |
|
27 * |
|
28 * For example, a test might look like this: |
|
29 * |
|
30 * var zip = /[\d]{5}$/; |
|
31 * |
|
32 * AddTestCase( |
|
33 * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test |
|
34 * "02134", // expected result |
|
35 * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result |
|
36 * |
|
37 */ |
|
38 |
|
39 function Foo() {} |
|
40 theproto = {}; |
|
41 Foo.prototype = theproto |
|
42 theproto instanceof Foo |
|
43 |
|
44 |
|
45 AddTestCase( "function Foo() {}; theproto = {}; Foo.prototype = theproto; theproto instanceof Foo", |
|
46 false, |
|
47 theproto instanceof Foo ); |
|
48 |
|
49 var f = new Function(); |
|
50 |
|
51 AddTestCase( "var f = new Function(); f instanceof f", false, f instanceof f ); |
|
52 |
|
53 |
|
54 test(); // leave this alone. this executes the test cases and |
|
55 // displays results. |