Debian Codegraph @

js/src/tests/test262/language/eval-code/direct/parse-failure-5.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 If Result(3).type is not normal, then Result(3).type must be throw.
7 Throw Result(3).value as an exception
8 es5id: 15.1.2.1_A3.3_T3
9 description: Return statement
10 ---*/
11
12 //CHECK#1
13 try {
14 eval("return;");
15 throw new Test262Error('#1.1: return must throw SyntaxError. Actual: ' + (eval("return;")));
16 } catch(e) {
17 if ((e instanceof SyntaxError) !== true) {
18 throw new Test262Error('#1.2: return must throw SyntaxError. Actual: ' + (e));
19 }
20 }
21
22 //CHECK#2
23
24 function f() { eval("return;"); };
25
26 try {
27 f();
28 throw new Test262Error('#2.1: return must throw SyntaxError. Actual: ' + (f()));
29 } catch(e) {
30 if ((e instanceof SyntaxError) !== true) {
31 throw new Test262Error('#2.2: return must throw SyntaxError. Actual: ' + (e));
32 }
33 }
34
35 reportCompare(0, 0);