Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-156354.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 /*
7 *
8 * Date: 16 September 2002
9 * SUMMARY: Testing propertyIsEnumerable() on non-existent property
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=156354
11 *
12 */
13 //-----------------------------------------------------------------------------
14 var gTestfile = 'regress-156354.js';
15 var UBound = 0;
16 var BUGNUMBER = 156354;
17 var summary = 'Testing propertyIsEnumerable() on non-existent property';
18 var status = '';
19 var statusitems = [];
20 var actual = '';
21 var actualvalues = [];
22 var expect= '';
23 var expectedvalues = [];
24
25
26 status = inSection(1);
27 actual = this.propertyIsEnumerable('XYZ');
28 expect = false;
29 addThis();
30
31 status = inSection(2);
32 actual = this.propertyIsEnumerable('');
33 expect = false;
34 addThis();
35
36 status = inSection(3);
37 actual = this.propertyIsEnumerable(undefined);
38 expect = false;
39 addThis();
40
41 status = inSection(4);
42 actual = this.propertyIsEnumerable(null);
43 expect = false;
44 addThis();
45
46 status = inSection(5);
47 actual = this.propertyIsEnumerable('\u02b1');
48 expect = false;
49 addThis();
50
51
52 var obj = {prop1:null};
53
54 status = inSection(6);
55 actual = obj.propertyIsEnumerable('prop1');
56 expect = true;
57 addThis();
58
59 status = inSection(7);
60 actual = obj.propertyIsEnumerable('prop2');
61 expect = false;
62 addThis();
63
64 // let's try one via eval(), too -
65 status = inSection(8);
66 eval("actual = obj.propertyIsEnumerable('prop2')");
67 expect = false;
68 addThis();
69
70
71
72 //-----------------------------------------------------------------------------
73 test();
74 //-----------------------------------------------------------------------------
75
76
77 function addThis()
78 {
79 statusitems[UBound] = status;
80 actualvalues[UBound] = actual;
81 expectedvalues[UBound] = expect;
82 UBound++;
83 }
84
85
86 function test()
87 {
88 enterFunc('test');
89 printBugNumber(BUGNUMBER);
90 printStatus(summary);
91
92 for (var i=0; i<UBound; i++)
93 {
94 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
95 }
96
97 exitFunc ('test');
98 }