Increase test coverage (#175)
* Increase test coverage * Test for error when binding `this` in destructuring pattern * Ignore coverage of inAsync check in parseAwait - already checked externally * Ignore coverage of default case in checkPropClash * Remove unused parameter isAsync from parseParenAndDistinguishExpression * Ignore coverage of an `else` branch in flowParseTypeParameterDeclaration * Flow: remove unused parameters to flowParseTypeAnnotatableIdentifier * Flow: ignore coverage of pass-through throw statement in parseConditional * Flow: Add test for error on property with type param * Flow: ignore coverage of pass-through throw statements in parseMaybeAssign, parseArrow * Add test for error on XML-style comment in module code * Update test for error on method in object pattern * Test for error: "Only '=' operator can be used for specifying default value"
This commit is contained in:
parent
490ae9a44c
commit
7c18bf83cc
@ -45,6 +45,7 @@ pp.checkPropClash = function (prop, propHash) {
|
||||
name = String(key.value);
|
||||
break;
|
||||
|
||||
// istanbul ignore next: non-computed property keys are always one of the above
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -555,7 +556,7 @@ pp.parseParenExpression = function () {
|
||||
return val;
|
||||
};
|
||||
|
||||
pp.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow, isAsync) {
|
||||
pp.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow) {
|
||||
startPos = startPos || this.state.start;
|
||||
startLoc = startLoc || this.state.startLoc;
|
||||
|
||||
@ -597,15 +598,11 @@ pp.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow
|
||||
if (param.extra && param.extra.parenthesized) this.unexpected(param.extra.parenStart);
|
||||
}
|
||||
|
||||
return this.parseArrowExpression(arrowNode, exprList, isAsync);
|
||||
return this.parseArrowExpression(arrowNode, exprList);
|
||||
}
|
||||
|
||||
if (!exprList.length) {
|
||||
if (isAsync) {
|
||||
return;
|
||||
} else {
|
||||
this.unexpected(this.state.lastTokStart);
|
||||
}
|
||||
this.unexpected(this.state.lastTokStart);
|
||||
}
|
||||
if (optionalCommaStart) this.unexpected(optionalCommaStart);
|
||||
if (spreadStart) this.unexpected(spreadStart);
|
||||
@ -1025,6 +1022,7 @@ pp.parseIdentifier = function (liberal) {
|
||||
// Parses await expression inside async function.
|
||||
|
||||
pp.parseAwait = function (node) {
|
||||
// istanbul ignore next: this condition is checked at the call site so won't be hit here
|
||||
if (!this.state.inAsync) {
|
||||
this.unexpected();
|
||||
}
|
||||
|
||||
@ -670,7 +670,6 @@ pp.parseClassBody = function (node) {
|
||||
|
||||
method.static = isMaybeStatic && !this.match(tt.parenL);
|
||||
if (method.static) {
|
||||
if (isGenerator) this.unexpected();
|
||||
isGenerator = this.eat(tt.star);
|
||||
this.parsePropertyName(method);
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ pp.flowParseTypeParameter = function () {
|
||||
|
||||
let variance = this.flowParseVariance();
|
||||
|
||||
let ident = this.flowParseTypeAnnotatableIdentifier(false, false);
|
||||
let ident = this.flowParseTypeAnnotatableIdentifier();
|
||||
node.name = ident.name;
|
||||
node.variance = variance;
|
||||
node.bound = ident.typeAnnotation;
|
||||
@ -227,6 +227,7 @@ pp.flowParseTypeParameterDeclaration = function () {
|
||||
|
||||
this.state.inType = true;
|
||||
|
||||
// istanbul ignore else: this condition is already checked at all call sites
|
||||
if (this.isRelational("<") || this.match(tt.jsxTagStart)) {
|
||||
this.next();
|
||||
} else {
|
||||
@ -705,26 +706,12 @@ pp.flowParseTypeAnnotation = function () {
|
||||
return this.finishNode(node, "TypeAnnotation");
|
||||
};
|
||||
|
||||
pp.flowParseTypeAnnotatableIdentifier = function (requireTypeAnnotation, canBeOptionalParam) {
|
||||
|
||||
pp.flowParseTypeAnnotatableIdentifier = function () {
|
||||
let ident = this.parseIdentifier();
|
||||
let isOptionalParam = false;
|
||||
|
||||
if (canBeOptionalParam && this.eat(tt.question)) {
|
||||
this.expect(tt.question);
|
||||
isOptionalParam = true;
|
||||
}
|
||||
|
||||
if (requireTypeAnnotation || this.match(tt.colon)) {
|
||||
if (this.match(tt.colon)) {
|
||||
ident.typeAnnotation = this.flowParseTypeAnnotation();
|
||||
this.finishNode(ident, ident.type);
|
||||
}
|
||||
|
||||
if (isOptionalParam) {
|
||||
ident.optional = true;
|
||||
this.finishNode(ident, ident.type);
|
||||
}
|
||||
|
||||
return ident;
|
||||
};
|
||||
|
||||
@ -824,6 +811,7 @@ export default function (instance) {
|
||||
refNeedsArrowPos.start = err.pos || this.state.start;
|
||||
return expr;
|
||||
} else {
|
||||
// istanbul ignore next: no such error is expected
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
@ -1208,6 +1196,7 @@ export default function (instance) {
|
||||
this.state = state;
|
||||
jsxError = err;
|
||||
} else {
|
||||
// istanbul ignore next: no such error is expected
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
@ -1262,6 +1251,7 @@ export default function (instance) {
|
||||
if (err instanceof SyntaxError) {
|
||||
this.state = state;
|
||||
} else {
|
||||
// istanbul ignore next: no such error is expected
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
@ -365,6 +365,7 @@ pp.jsxParseElementAt = function(startPos, startLoc) {
|
||||
|
||||
break;
|
||||
|
||||
// istanbul ignore next - should never happen
|
||||
default:
|
||||
this.unexpected();
|
||||
}
|
||||
|
||||
4
test/fixtures/core/categorized/label-kind-switch/actual.js
vendored
Normal file
4
test/fixtures/core/categorized/label-kind-switch/actual.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
a: switch (i) {
|
||||
}
|
||||
}
|
||||
117
test/fixtures/core/categorized/label-kind-switch/expected.json
vendored
Normal file
117
test/fixtures/core/categorized/label-kind-switch/expected.json
vendored
Normal file
@ -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
test/fixtures/core/categorized/malformed-switch/actual.js
vendored
Normal file
3
test/fixtures/core/categorized/malformed-switch/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
switch (x) {
|
||||
var y = 5;
|
||||
}
|
||||
3
test/fixtures/core/categorized/malformed-switch/options.json
vendored
Normal file
3
test/fixtures/core/categorized/malformed-switch/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (2:2)"
|
||||
}
|
||||
3
test/fixtures/es2015/class-methods/direct-super-outside-constructor/actual.js
vendored
Normal file
3
test/fixtures/es2015/class-methods/direct-super-outside-constructor/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
class A {
|
||||
x () {super()}
|
||||
}
|
||||
3
test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json
vendored
Normal file
3
test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "super() outside of class constructor (2:8)"
|
||||
}
|
||||
3
test/fixtures/es2015/class-methods/disallow-static-prototype/actual.js
vendored
Normal file
3
test/fixtures/es2015/class-methods/disallow-static-prototype/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
class A {
|
||||
static prototype() {}
|
||||
}
|
||||
3
test/fixtures/es2015/class-methods/disallow-static-prototype/options.json
vendored
Normal file
3
test/fixtures/es2015/class-methods/disallow-static-prototype/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Classes may not have static property named prototype (2:9)"
|
||||
}
|
||||
3
test/fixtures/es2015/class-methods/getter-signature/actual.js
vendored
Normal file
3
test/fixtures/es2015/class-methods/getter-signature/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
class A {
|
||||
get prop (arg) {}
|
||||
}
|
||||
3
test/fixtures/es2015/class-methods/getter-signature/options.json
vendored
Normal file
3
test/fixtures/es2015/class-methods/getter-signature/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "getter should have no params (2:2)"
|
||||
}
|
||||
5
test/fixtures/es2015/class-methods/malformed-super-expression/actual.js
vendored
Normal file
5
test/fixtures/es2015/class-methods/malformed-super-expression/actual.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
class A {
|
||||
x () {
|
||||
super - 1;
|
||||
}
|
||||
}
|
||||
3
test/fixtures/es2015/class-methods/malformed-super-expression/options.json
vendored
Normal file
3
test/fixtures/es2015/class-methods/malformed-super-expression/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (3:10)"
|
||||
}
|
||||
1
test/fixtures/es2015/destructuring/binding-this/actual.js
vendored
Normal file
1
test/fixtures/es2015/destructuring/binding-this/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var { this };
|
||||
3
test/fixtures/es2015/destructuring/binding-this/options.json
vendored
Normal file
3
test/fixtures/es2015/destructuring/binding-this/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Binding this (1:6)"
|
||||
}
|
||||
1
test/fixtures/es2015/destructuring/error-operator-for-default/actual.js
vendored
Normal file
1
test/fixtures/es2015/destructuring/error-operator-for-default/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
([a += a] = a)
|
||||
3
test/fixtures/es2015/destructuring/error-operator-for-default/options.json
vendored
Normal file
3
test/fixtures/es2015/destructuring/error-operator-for-default/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Only '=' operator can be used for specifying default value. (1:3)"
|
||||
}
|
||||
1
test/fixtures/es2015/modules/xml-comment-in-module/actual.js
vendored
Normal file
1
test/fixtures/es2015/modules/xml-comment-in-module/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
foo <!--bar
|
||||
3
test/fixtures/es2015/modules/xml-comment-in-module/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/xml-comment-in-module/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:4)"
|
||||
}
|
||||
3
test/fixtures/es2017/async-functions/no-constructor/actual.js
vendored
Normal file
3
test/fixtures/es2017/async-functions/no-constructor/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
class A {
|
||||
async constructor() {}
|
||||
}
|
||||
3
test/fixtures/es2017/async-functions/no-constructor/options.json
vendored
Normal file
3
test/fixtures/es2017/async-functions/no-constructor/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Constructor can't be an async function (2:8)"
|
||||
}
|
||||
@ -1 +1 @@
|
||||
({get a(){}})=0
|
||||
({a(){}})=0
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Object pattern can't contain getter or setter (1:6)"
|
||||
}
|
||||
"throws": "Object pattern can't contain methods (1:2)"
|
||||
}
|
||||
|
||||
1
test/fixtures/experimental/no-async-generators/error-without-plugin/actual.js
vendored
Normal file
1
test/fixtures/experimental/no-async-generators/error-without-plugin/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
async function * f () {}
|
||||
4
test/fixtures/experimental/no-async-generators/error-without-plugin/options.json
vendored
Normal file
4
test/fixtures/experimental/no-async-generators/error-without-plugin/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:15)",
|
||||
"plugins": []
|
||||
}
|
||||
3
test/fixtures/flow/type-parameter-declaration/error-object-property-type-param/actual.js
vendored
Normal file
3
test/fixtures/flow/type-parameter-declaration/error-object-property-type-param/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const s = {
|
||||
p<T>
|
||||
}
|
||||
3
test/fixtures/flow/type-parameter-declaration/error-object-property-type-param/options.json
vendored
Normal file
3
test/fixtures/flow/type-parameter-declaration/error-object-property-type-param/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (3:0)"
|
||||
}
|
||||
1
test/fixtures/jsx/basic/entity/actual.js
vendored
Normal file
1
test/fixtures/jsx/basic/entity/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
<A>💩</A>
|
||||
147
test/fixtures/jsx/basic/entity/expected.json
vendored
Normal file
147
test/fixtures/jsx/basic/entity/expected.json
vendored
Normal file
@ -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
test/fixtures/jsx/basic/nonentity-decimal/actual.js
vendored
Normal file
1
test/fixtures/jsx/basic/nonentity-decimal/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
<A>f4a9;</A>
|
||||
147
test/fixtures/jsx/basic/nonentity-decimal/expected.json
vendored
Normal file
147
test/fixtures/jsx/basic/nonentity-decimal/expected.json
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "JSXElement",
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"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": 11,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start": 13,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"name": "A"
|
||||
}
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "JSXText",
|
||||
"start": 3,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"extra": null,
|
||||
"value": "f4a9;"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/jsx/basic/nonentity/actual.js
vendored
Normal file
1
test/fixtures/jsx/basic/nonentity/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
<A>g4q9;</A>
|
||||
147
test/fixtures/jsx/basic/nonentity/expected.json
vendored
Normal file
147
test/fixtures/jsx/basic/nonentity/expected.json
vendored
Normal file
@ -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": "g4q9;"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/jsx/errors/unicode-escape-in-identifier/actual.js
vendored
Normal file
1
test/fixtures/jsx/errors/unicode-escape-in-identifier/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
<\u{2F804}></\u{2F804}>
|
||||
3
test/fixtures/jsx/errors/unicode-escape-in-identifier/options.json
vendored
Normal file
3
test/fixtures/jsx/errors/unicode-escape-in-identifier/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:1)"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user