]>
Commit | Line | Data |
---|---|---|
b37bf2e1 A |
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-7635.js | |
24 | * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=7635 | |
25 | * Description: instanceof tweaks | |
26 | * Author: | |
27 | */ | |
28 | ||
ba379fdc A |
29 | var SECTION = "instanceof"; // provide a document reference (ie, ECMA section) |
30 | var VERSION = "ECMA_2"; // Version of JavaScript or ECMA | |
31 | var TITLE = "Regression test for Bugzilla #7635"; // Provide ECMA section title or a description | |
32 | var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7635"; // Provide URL to bugsplat or bugzilla report | |
b37bf2e1 | 33 | |
ba379fdc | 34 | startTest(); // leave this alone |
b37bf2e1 | 35 | |
ba379fdc A |
36 | /* |
37 | * Calls to AddTestCase here. AddTestCase is a function that is defined | |
38 | * in shell.js and takes three arguments: | |
39 | * - a string representation of what is being tested | |
40 | * - the expected result | |
41 | * - the actual result | |
42 | * | |
43 | * For example, a test might look like this: | |
44 | * | |
45 | * var zip = /[\d]{5}$/; | |
46 | * | |
47 | * AddTestCase( | |
48 | * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test | |
49 | * "02134", // expected result | |
50 | * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result | |
51 | * | |
52 | */ | |
b37bf2e1 | 53 | |
ba379fdc A |
54 | function Foo() {} |
55 | theproto = {}; | |
56 | Foo.prototype = theproto | |
57 | theproto instanceof Foo | |
b37bf2e1 | 58 | |
b37bf2e1 | 59 | |
ba379fdc A |
60 | AddTestCase( "function Foo() {}; theproto = {}; Foo.prototype = theproto; theproto instanceof Foo", |
61 | false, | |
62 | theproto instanceof Foo ); | |
b37bf2e1 | 63 | |
ba379fdc | 64 | var f = new Function(); |
b37bf2e1 | 65 | |
ba379fdc | 66 | AddTestCase( "var f = new Function(); f instanceof f", false, f instanceof f ); |
b37bf2e1 A |
67 | |
68 | ||
ba379fdc A |
69 | test(); // leave this alone. this executes the test cases and |
70 | // displays results. |