Skip to content

Commit be425c1

Browse files
committed
added more es6 tests
1 parent 9286051 commit be425c1

6 files changed

Lines changed: 121 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{ code: 'const MY_FAV = 7;\nconst MY_FAV = 20;\nconst MY_FAV2 = 25;',
2+
trace:
3+
[ { event: 'uncaught_exception',
4+
exception_msg: 'SyntaxError: Identifier \'MY_FAV\' has already been declared\n(sorry, tool can\'t find the line number)' } ] }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const MY_FAV = 7;
2+
const MY_FAV = 20;
3+
const MY_FAV2 = 25;
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{ code: 'var a = 5;\nvar b = 10;\n\nif (a === 5) {\n let a = 4; // The scope is inside the if-block\n var b = 1; // The scope is inside the function\n\n console.log(a); // 4\n console.log(b); // 1\n} \n\nconsole.log(a); // 5\nconsole.log(b); // 1',
2+
trace:
3+
[ { stdout: '',
4+
func_name: '',
5+
stack_to_render: [],
6+
globals:
7+
{ a: [ 'JS_SPECIAL_VAL', 'undefined' ],
8+
b: [ 'JS_SPECIAL_VAL', 'undefined' ] },
9+
ordered_globals: [ 'a', 'b' ],
10+
line: 1,
11+
col: 0,
12+
event: 'step_line',
13+
heap: {} },
14+
{ stdout: '',
15+
func_name: '',
16+
stack_to_render: [],
17+
globals: { a: 5, b: [ 'JS_SPECIAL_VAL', 'undefined' ] },
18+
ordered_globals: [ 'a', 'b' ],
19+
line: 2,
20+
col: 0,
21+
event: 'step_line',
22+
heap: {} },
23+
{ stdout: '',
24+
func_name: '',
25+
stack_to_render: [],
26+
globals: { a: 5, b: 10 },
27+
ordered_globals: [ 'a', 'b' ],
28+
line: 4,
29+
col: 0,
30+
event: 'step_line',
31+
heap: {} },
32+
{ stdout: '',
33+
func_name: '',
34+
stack_to_render: [],
35+
globals: { a: 5, b: 10 },
36+
ordered_globals: [ 'a', 'b' ],
37+
line: 5,
38+
col: 2,
39+
event: 'step_line',
40+
heap: {} },
41+
{ stdout: '',
42+
func_name: '',
43+
stack_to_render: [],
44+
globals: { a: 5, b: 10 },
45+
ordered_globals: [ 'a', 'b' ],
46+
line: 6,
47+
col: 2,
48+
event: 'step_line',
49+
heap: {} },
50+
{ stdout: '',
51+
func_name: '',
52+
stack_to_render: [],
53+
globals: { a: 5, b: 1 },
54+
ordered_globals: [ 'a', 'b' ],
55+
line: 8,
56+
col: 2,
57+
event: 'step_line',
58+
heap: {} },
59+
{ stdout: '4\n',
60+
func_name: '',
61+
stack_to_render: [],
62+
globals: { a: 5, b: 1 },
63+
ordered_globals: [ 'a', 'b' ],
64+
line: 9,
65+
col: 2,
66+
event: 'step_line',
67+
heap: {} },
68+
{ stdout: '4\n1\n',
69+
func_name: '',
70+
stack_to_render: [],
71+
globals: { a: 5, b: 1 },
72+
ordered_globals: [ 'a', 'b' ],
73+
line: 12,
74+
col: 0,
75+
event: 'step_line',
76+
heap: {} },
77+
{ stdout: '4\n1\n5\n',
78+
func_name: '',
79+
stack_to_render: [],
80+
globals: { a: 5, b: 1 },
81+
ordered_globals: [ 'a', 'b' ],
82+
line: 13,
83+
col: 0,
84+
event: 'step_line',
85+
heap: {} },
86+
{ stdout: '4\n1\n5\n1\n',
87+
func_name: '',
88+
stack_to_render: [],
89+
globals: { a: 5, b: 1 },
90+
ordered_globals: [ 'a', 'b' ],
91+
line: 13,
92+
col: 20,
93+
event: 'step_line',
94+
heap: {} } ] }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var a = 5;
2+
var b = 10;
3+
4+
if (a === 5) {
5+
let a = 4; // The scope is inside the if-block
6+
var b = 1; // The scope is inside the function
7+
8+
console.log(a); // 4
9+
console.log(b); // 1
10+
}
11+
12+
console.log(a); // 5
13+
console.log(b); // 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{ code: 'let x = 5;\nlet x = 10;\nvar y = 15;',
2+
trace:
3+
[ { event: 'uncaught_exception',
4+
exception_msg: 'SyntaxError: Identifier \'x\' has already been declared\n(sorry, tool can\'t find the line number)' } ] }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let x = 5;
2+
let x = 10;
3+
var y = 15;

0 commit comments

Comments
 (0)