Debian Codegraph @

rhino/testsrc/tests/js1_8/extensions/regress-353116.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-353116.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 353116;
9 var summary = 'Improve errors messages for null, undefined properties';
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 expect = 'TypeError: undefined has no properties';
25 actual = 'No Error';
26
27 try
28 {
29 undefined.y;
30 }
31 catch(ex)
32 {
33 actual = ex + '';
34 }
35 reportCompare(expect, actual, summary);
36
37 expect = 'TypeError: null has no properties';
38 actual = 'No Error';
39
40 try
41 {
42 null.y;
43 }
44 catch(ex)
45 {
46 actual = ex + '';
47 }
48 reportCompare(expect, actual, summary);
49
50 expect = 'TypeError: x is undefined';
51 actual = 'No Error';
52
53 try
54 {
55 x = undefined;
56 x.y;
57 }
58 catch(ex)
59 {
60 actual = ex + '';
61 }
62 reportCompare(expect, actual, summary);
63
64 expect = 'TypeError: x is null';
65 actual = 'No Error';
66
67 try
68 {
69 x = null;
70 x.y;
71 }
72 catch(ex)
73 {
74 actual = ex + '';
75 }
76 reportCompare(expect, actual, summary);
77
78 exitFunc ('test');
79 }