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