Debian Codegraph @

rhino/testsrc/tests/ecma_3/extensions/regress-188206-01.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 //-----------------------------------------------------------------------------
7 var gTestfile = 'regress-188206-01.js';
8 var UBound = 0;
9 var BUGNUMBER = 188206;
10 var summary = 'Invalid use of regexp quantifiers should generate SyntaxErrors';
11 var TEST_PASSED = 'SyntaxError';
12 var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
13 var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
14 var status = '';
15 var statusitems = [];
16 var actual = '';
17 var actualvalues = [];
18 var expect= '';
19 var expectedvalues = [];
20
21
22 /*
23 * Now do some weird things on the left side of the regexps -
24 */
25 status = inSection(7);
26 testThis(' /*a/ ');
27
28 status = inSection(8);
29 testThis(' /**a/ ');
30
31
32 //-----------------------------------------------------------------------------
33 test();
34 //-----------------------------------------------------------------------------
35
36 /*
37 * Invalid syntax should generate a SyntaxError
38 */
39 function testThis(sInvalidSyntax)
40 {
41 expect = TEST_PASSED;
42 actual = TEST_FAILED_BADLY;
43
44 try
45 {
46 eval(sInvalidSyntax);
47 }
48 catch(e)
49 {
50 if (e instanceof SyntaxError)
51 actual = TEST_PASSED;
52 else
53 actual = TEST_FAILED;
54 }
55
56 statusitems[UBound] = status;
57 expectedvalues[UBound] = expect;
58 actualvalues[UBound] = actual;
59 UBound++;
60 }
61
62
63 function test()
64 {
65 enterFunc('test');
66 printBugNumber(BUGNUMBER);
67 printStatus(summary);
68
69 for (var i=0; i<UBound; i++)
70 {
71 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
72 }
73
74 exitFunc ('test');
75 }