js/src/tests/js1_5/extensions/regress-365869.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:a97327329ec3
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 var BUGNUMBER = 365869;
8 var summary = 'strict warning for object literal with duplicate propery names';
9 var actual = '';
10 var expect = '';
11
12
13 //-----------------------------------------------------------------------------
14 test();
15 //-----------------------------------------------------------------------------
16
17 function test()
18 {
19 enterFunc ('test');
20 printBugNumber(BUGNUMBER);
21 printStatus (summary);
22
23 if (!options().match(/strict/))
24 {
25 options('strict');
26 }
27 if (!options().match(/werror/))
28 {
29 options('werror');
30 }
31
32 try
33 {
34 expect = 'SyntaxError: property name a appears more than once in object literal';
35 eval('({a:4, a:5})');
36 // syntax warning, need to eval to catch
37 actual = 'No warning';
38 }
39 catch(ex)
40 {
41 actual = ex + '';
42 }
43
44 reportCompare(expect, actual, summary);
45
46 print('test crash from bug 371292 Comment 3');
47
48 try
49 {
50 expect = 'SyntaxError: property name 1 appears more than once in object literal';
51 eval('({1:1, 1:2})');
52 // syntax warning, need to eval to catch
53 actual = 'No warning';
54 }
55 catch(ex)
56 {
57 actual = ex + '';
58 }
59
60 reportCompare(expect, actual, summary);
61
62
63 print('test crash from bug 371292 Comment 9');
64
65 try
66 {
67 expect = "TypeError: can't redefine non-configurable property '5'";
68 "012345".__defineSetter__(5, function(){});
69 }
70 catch(ex)
71 {
72 actual = ex + '';
73 }
74
75 reportCompare(expect, actual, summary);
76
77
78 exitFunc ('test');
79 }

mercurial