1/* Copyright JS Foundation and other contributors, http://js.foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16try {
17  let a = 1;
18  eval ("assert(a === 1)");
19} catch (e) {
20  assert (false);
21}
22
23assert (typeof a === "undefined");
24
25try {
26  let a = 2;
27  eval ("assert(a === 2)");
28
29  assert (typeof b === "undefined");
30  throw 3;
31} catch (e) {
32  let b = e;
33  eval ("assert(b === 3)");
34
35  assert (typeof a === "undefined");
36}
37
38assert (typeof a === "undefined");
39assert (typeof b === "undefined");
40
41try {
42  let a = 4;
43  eval ("assert(a === 4)");
44
45  assert (typeof b === "undefined");
46} finally {
47  let b = 5;
48  eval ("assert(b === 5)");
49
50  assert (typeof a === "undefined");
51}
52
53assert (typeof a === "undefined");
54assert (typeof b === "undefined");
55
56try {
57  let a = 6;
58  eval ("assert(a === 6)");
59
60  assert (typeof b === "undefined");
61  assert (typeof c === "undefined");
62  throw 7;
63} catch (e) {
64  let b = e;
65  eval ("assert(b === 7)");
66
67  assert (typeof a === "undefined");
68  assert (typeof c === "undefined");
69} finally {
70  let c = 8;
71  eval ("assert(c === 8)");
72
73  assert (typeof a === "undefined");
74  assert (typeof b === "undefined");
75}
76
77assert (typeof a === "undefined");
78assert (typeof b === "undefined");
79assert (typeof c === "undefined");
80