Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-365869.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-365869.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 365869;
9 var summary = 'strict warning for object literal with duplicate propery names';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 if (!options().match(/strict/))
25 {
26 options('strict');
27 }
28 if (!options().match(/werror/))
29 {
30 options('werror');
31 }
32
33 try
34 {
35 expect = 'TypeError: redeclaration of property a';
36 var o = {a:4, a:5};
37 // syntax warning, need to eval to catch
38 actual = 'No warning';
39 }
40 catch(ex)
41 {
42 actual = ex + '';
43 print(ex);
44 }
45
46 reportCompare(expect, actual, summary);
47
48 print('test crash from bug 371292 Comment 3');
49
50 try
51 {
52 expect = 'TypeError: redeclaration of property 1';
53 var o1 = {1:1, 1:2};
54 // syntax warning, need to eval to catch
55 actual = 'No warning';
56 }
57 catch(ex)
58 {
59 actual = ex + '';
60 print(ex);
61 }
62
63 reportCompare(expect, actual, summary);
64
65
66 print('test crash from bug 371292 Comment 9');
67
68 try
69 {
70 expect = 'TypeError: redeclaration of const 5';
71 "012345".__defineSetter__(5, function(){});
72 }
73 catch(ex)
74 {
75 actual = ex + '';
76 print(ex);
77 }
78
79 reportCompare(expect, actual, summary);
80
81
82 exitFunc ('test');
83 }