Skip to content

Commit

Permalink
Fix: tests for importing keywords (fixes #225)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Jan 19, 2016
1 parent f888857 commit b07696f
Show file tree
Hide file tree
Showing 7 changed files with 291 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
},
"license": "BSD-2-Clause",
"devDependencies": {
"acorn": "^2.7.0",
"browserify": "^7.0.0",
"chai": "^1.10.0",
"complexity-report": "~0.6.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
module.exports = {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 31
}
},
"range": [
0,
31
],
"body": [
{
"type": "ImportDeclaration",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 31
}
},
"range": [
0,
31
],
"specifiers": [
{
"type": "ImportSpecifier",
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 18
}
},
"range": [
8,
18
],
"imported": {
"type": "Identifier",
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
8,
11
],
"name": "var"
},
"local": {
"type": "Identifier",
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 18
}
},
"range": [
15,
18
],
"name": "baz"
}
}
],
"source": {
"type": "Literal",
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 30
}
},
"range": [
25,
30
],
"value": "foo",
"raw": "\"foo\""
}
}
],
"sourceType": "module",
"tokens": [
{
"type": "Keyword",
"value": "import",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"range": [
0,
6
]
},
{
"type": "Punctuator",
"value": "{",
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 8
}
},
"range": [
7,
8
]
},
{
"type": "Keyword",
"value": "var",
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
8,
11
]
},
{
"type": "Identifier",
"value": "as",
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 14
}
},
"range": [
12,
14
]
},
{
"type": "Identifier",
"value": "baz",
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 18
}
},
"range": [
15,
18
]
},
{
"type": "Punctuator",
"value": "}",
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 19
}
},
"range": [
18,
19
]
},
{
"type": "Identifier",
"value": "from",
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 24
}
},
"range": [
20,
24
]
},
{
"type": "String",
"value": "\"foo\"",
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 30
}
},
"range": [
25,
30
]
},
{
"type": "Punctuator",
"value": ";",
"loc": {
"start": {
"line": 1,
"column": 30
},
"end": {
"line": 1,
"column": 31
}
},
"range": [
30,
31
]
}
]
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import {var as baz} from "foo";
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
"index": 15,
"lineNumber": 1,
"column": 16,
"message": "Unexpected token var"
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import {foo as var} from "foo"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
"index": 8,
"lineNumber": 1,
"column": 9,
"message": "Unexpected token var"
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import {var} from "foo"

0 comments on commit b07696f

Please sign in to comment.