Skip to content

Commit b07696f

Browse files
committed
Fix: tests for importing keywords (fixes #225)
1 parent f888857 commit b07696f

7 files changed

+291
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
},
3232
"license": "BSD-2-Clause",
3333
"devDependencies": {
34+
"acorn": "^2.7.0",
3435
"browserify": "^7.0.0",
3536
"chai": "^1.10.0",
3637
"complexity-report": "~0.6.1",
Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
module.exports = {
2+
"type": "Program",
3+
"loc": {
4+
"start": {
5+
"line": 1,
6+
"column": 0
7+
},
8+
"end": {
9+
"line": 1,
10+
"column": 31
11+
}
12+
},
13+
"range": [
14+
0,
15+
31
16+
],
17+
"body": [
18+
{
19+
"type": "ImportDeclaration",
20+
"loc": {
21+
"start": {
22+
"line": 1,
23+
"column": 0
24+
},
25+
"end": {
26+
"line": 1,
27+
"column": 31
28+
}
29+
},
30+
"range": [
31+
0,
32+
31
33+
],
34+
"specifiers": [
35+
{
36+
"type": "ImportSpecifier",
37+
"loc": {
38+
"start": {
39+
"line": 1,
40+
"column": 8
41+
},
42+
"end": {
43+
"line": 1,
44+
"column": 18
45+
}
46+
},
47+
"range": [
48+
8,
49+
18
50+
],
51+
"imported": {
52+
"type": "Identifier",
53+
"loc": {
54+
"start": {
55+
"line": 1,
56+
"column": 8
57+
},
58+
"end": {
59+
"line": 1,
60+
"column": 11
61+
}
62+
},
63+
"range": [
64+
8,
65+
11
66+
],
67+
"name": "var"
68+
},
69+
"local": {
70+
"type": "Identifier",
71+
"loc": {
72+
"start": {
73+
"line": 1,
74+
"column": 15
75+
},
76+
"end": {
77+
"line": 1,
78+
"column": 18
79+
}
80+
},
81+
"range": [
82+
15,
83+
18
84+
],
85+
"name": "baz"
86+
}
87+
}
88+
],
89+
"source": {
90+
"type": "Literal",
91+
"loc": {
92+
"start": {
93+
"line": 1,
94+
"column": 25
95+
},
96+
"end": {
97+
"line": 1,
98+
"column": 30
99+
}
100+
},
101+
"range": [
102+
25,
103+
30
104+
],
105+
"value": "foo",
106+
"raw": "\"foo\""
107+
}
108+
}
109+
],
110+
"sourceType": "module",
111+
"tokens": [
112+
{
113+
"type": "Keyword",
114+
"value": "import",
115+
"loc": {
116+
"start": {
117+
"line": 1,
118+
"column": 0
119+
},
120+
"end": {
121+
"line": 1,
122+
"column": 6
123+
}
124+
},
125+
"range": [
126+
0,
127+
6
128+
]
129+
},
130+
{
131+
"type": "Punctuator",
132+
"value": "{",
133+
"loc": {
134+
"start": {
135+
"line": 1,
136+
"column": 7
137+
},
138+
"end": {
139+
"line": 1,
140+
"column": 8
141+
}
142+
},
143+
"range": [
144+
7,
145+
8
146+
]
147+
},
148+
{
149+
"type": "Keyword",
150+
"value": "var",
151+
"loc": {
152+
"start": {
153+
"line": 1,
154+
"column": 8
155+
},
156+
"end": {
157+
"line": 1,
158+
"column": 11
159+
}
160+
},
161+
"range": [
162+
8,
163+
11
164+
]
165+
},
166+
{
167+
"type": "Identifier",
168+
"value": "as",
169+
"loc": {
170+
"start": {
171+
"line": 1,
172+
"column": 12
173+
},
174+
"end": {
175+
"line": 1,
176+
"column": 14
177+
}
178+
},
179+
"range": [
180+
12,
181+
14
182+
]
183+
},
184+
{
185+
"type": "Identifier",
186+
"value": "baz",
187+
"loc": {
188+
"start": {
189+
"line": 1,
190+
"column": 15
191+
},
192+
"end": {
193+
"line": 1,
194+
"column": 18
195+
}
196+
},
197+
"range": [
198+
15,
199+
18
200+
]
201+
},
202+
{
203+
"type": "Punctuator",
204+
"value": "}",
205+
"loc": {
206+
"start": {
207+
"line": 1,
208+
"column": 18
209+
},
210+
"end": {
211+
"line": 1,
212+
"column": 19
213+
}
214+
},
215+
"range": [
216+
18,
217+
19
218+
]
219+
},
220+
{
221+
"type": "Identifier",
222+
"value": "from",
223+
"loc": {
224+
"start": {
225+
"line": 1,
226+
"column": 20
227+
},
228+
"end": {
229+
"line": 1,
230+
"column": 24
231+
}
232+
},
233+
"range": [
234+
20,
235+
24
236+
]
237+
},
238+
{
239+
"type": "String",
240+
"value": "\"foo\"",
241+
"loc": {
242+
"start": {
243+
"line": 1,
244+
"column": 25
245+
},
246+
"end": {
247+
"line": 1,
248+
"column": 30
249+
}
250+
},
251+
"range": [
252+
25,
253+
30
254+
]
255+
},
256+
{
257+
"type": "Punctuator",
258+
"value": ";",
259+
"loc": {
260+
"start": {
261+
"line": 1,
262+
"column": 30
263+
},
264+
"end": {
265+
"line": 1,
266+
"column": 31
267+
}
268+
},
269+
"range": [
270+
30,
271+
31
272+
]
273+
}
274+
]
275+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import {var as baz} from "foo";
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
"index": 15,
3+
"lineNumber": 1,
4+
"column": 16,
5+
"message": "Unexpected token var"
6+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import {foo as var} from "foo"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
"index": 8,
3+
"lineNumber": 1,
4+
"column": 9,
5+
"message": "Unexpected token var"
6+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import {var} from "foo"

0 commit comments

Comments
 (0)