|
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: 14 April 2003 |
|
9 * SUMMARY: |delete x.y| should return |true| if |x| has no property |y| |
|
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=201987 |
|
11 * |
|
12 */ |
|
13 //----------------------------------------------------------------------------- |
|
14 var UBound = 0; |
|
15 var BUGNUMBER = 201987; |
|
16 var summary = '|delete x.y| should return |true| if |x| has no property |y|'; |
|
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 var x = {}; |
|
27 actual = delete x.y; |
|
28 expect = true; |
|
29 addThis(); |
|
30 |
|
31 status = inSection(2); |
|
32 actual = delete {}.y; |
|
33 expect = true; |
|
34 addThis(); |
|
35 |
|
36 status = inSection(3); |
|
37 actual = delete "".y; |
|
38 expect = true; |
|
39 addThis(); |
|
40 |
|
41 status = inSection(4); |
|
42 actual = delete /abc/.y; |
|
43 expect = true; |
|
44 addThis(); |
|
45 |
|
46 status = inSection(5); |
|
47 actual = delete (new Date()).y; |
|
48 expect = true; |
|
49 addThis(); |
|
50 |
|
51 status = inSection(6); |
|
52 var x = 99; |
|
53 actual = delete x.y; |
|
54 expect = true; |
|
55 addThis(); |
|
56 |
|
57 |
|
58 |
|
59 //----------------------------------------------------------------------------- |
|
60 test(); |
|
61 //----------------------------------------------------------------------------- |
|
62 |
|
63 |
|
64 |
|
65 function addThis() |
|
66 { |
|
67 statusitems[UBound] = status; |
|
68 actualvalues[UBound] = actual; |
|
69 expectedvalues[UBound] = expect; |
|
70 UBound++; |
|
71 } |
|
72 |
|
73 |
|
74 function test() |
|
75 { |
|
76 enterFunc('test'); |
|
77 printBugNumber(BUGNUMBER); |
|
78 printStatus(summary); |
|
79 |
|
80 for (var i=0; i<UBound; i++) |
|
81 { |
|
82 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); |
|
83 } |
|
84 |
|
85 exitFunc ('test'); |
|
86 } |