Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-245113.js

raw symbols SCIP
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 var gTestfile = 'regress-245113.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 245113;
9 var summary = 'instanceof operator should return false for class prototype';
10 var actual = '';
11 var expect = '';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15
16 Date.prototype.test = function() {
17 return (this instanceof Date);
18 };
19
20 String.prototype.test = function() {
21 return (this instanceof String);
22 };
23
24 status = summary + inSection(1);
25 expect = false;
26 actual = (Date.prototype.test instanceof Date);
27 reportCompare(expect, actual, status);
28
29 status = summary + inSection(2);
30 expect = false;
31 actual = Date.prototype.test();
32 reportCompare(expect, actual, status);
33
34 status = summary + inSection(3);
35 expect = false;
36 actual = String.prototype.test();
37 reportCompare(expect, actual, status);
38
39 status = summary + inSection(4);
40 expect = true;
41 actual = (new Date()).test();
42 reportCompare(expect, actual, status);
43
44 status = summary + inSection(5);
45 expect = true;
46 actual = (new String()).test();
47 reportCompare(expect, actual, status);
48