Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Increase test coverage #175

Merged
merged 14 commits into from
Oct 16, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/parser/statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ pp.parseClassBody = function (node) {

method.static = isMaybeStatic && !this.match(tt.parenL);
if (method.static) {
if (isGenerator) this.unexpected();
isGenerator = this.eat(tt.star);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was never triggered?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, method.static hinges on this.match(tt.name) and isGenerator (subsequently) on this.eat(tt.star). So they are mutually exclusive.

this.parsePropertyName(method);
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/jsx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ pp.jsxParseElementAt = function(startPos, startLoc) {

break;

// istanbul ignore next - should never happen
default:
this.unexpected();
}
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/core/categorized/label-kind-switch/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
a: switch (i) {
}
}
117 changes: 117 additions & 0 deletions test/fixtures/core/categorized/label-kind-switch/expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"type": "File",
"start": 0,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"sourceType": "script",
"body": [
{
"type": "BlockStatement",
"start": 0,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"body": [
{
"type": "LabeledStatement",
"start": 4,
"end": 23,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 3,
"column": 3
}
},
"body": {
"type": "SwitchStatement",
"start": 7,
"end": 23,
"loc": {
"start": {
"line": 2,
"column": 5
},
"end": {
"line": 3,
"column": 3
}
},
"discriminant": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 2,
"column": 13
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "i"
},
"name": "i"
},
"cases": []
},
"label": {
"type": "Identifier",
"start": 4,
"end": 5,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 3
},
"identifierName": "a"
},
"name": "a"
}
}
],
"directives": []
}
],
"directives": []
}
}
3 changes: 3 additions & 0 deletions test/fixtures/core/categorized/malformed-switch/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
switch (x) {
var y = 5;
}
3 changes: 3 additions & 0 deletions test/fixtures/core/categorized/malformed-switch/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"throws": "Unexpected token (2:2)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class A {
x () {super()}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"throws": "super() outside of class constructor (2:8)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class A {
static prototype() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"throws": "Classes may not have static property named prototype (2:9)"
}
3 changes: 3 additions & 0 deletions test/fixtures/es2015/class-methods/getter-signature/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class A {
get prop (arg) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"throws": "getter should have no params (2:2)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class A {
x () {
super - 1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"throws": "Unexpected token (3:10)"
}
3 changes: 3 additions & 0 deletions test/fixtures/es2017/async-functions/no-constructor/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class A {
async constructor() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"throws": "Constructor can't be an async function (2:8)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
async function * f () {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"throws": "Unexpected token (1:15)",
"plugins": []
}
1 change: 1 addition & 0 deletions test/fixtures/jsx/basic/entity/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<A>&#x1f4a9;</A>
147 changes: 147 additions & 0 deletions test/fixtures/jsx/basic/entity/expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"type": "File",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 16
}
},
"program": {
"type": "Program",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 16
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 16
}
},
"expression": {
"type": "JSXElement",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 16
}
},
"openingElement": {
"type": "JSXOpeningElement",
"start": 0,
"end": 3,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 3
}
},
"attributes": [],
"name": {
"type": "JSXIdentifier",
"start": 1,
"end": 2,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 2
}
},
"name": "A"
},
"selfClosing": false
},
"closingElement": {
"type": "JSXClosingElement",
"start": 12,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 16
}
},
"name": {
"type": "JSXIdentifier",
"start": 14,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 15
}
},
"name": "A"
}
},
"children": [
{
"type": "JSXText",
"start": 3,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 12
}
},
"extra": null,
"value": ""
}
]
}
}
],
"directives": []
}
}
1 change: 1 addition & 0 deletions test/fixtures/jsx/basic/nonentity-decimal/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<A>&#1f4a9;</A>
Loading