Add tests for class property ASI.
This commit is contained in:
parent
0c35bbfc07
commit
abd39d688e
4
test/fixtures/experimental/class-properties/asi-failure/actual.js
vendored
Normal file
4
test/fixtures/experimental/class-properties/asi-failure/actual.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
class Foo {
|
||||
p = x
|
||||
[m] () {}
|
||||
}
|
||||
4
test/fixtures/experimental/class-properties/asi-failure/options.json
vendored
Normal file
4
test/fixtures/experimental/class-properties/asi-failure/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"throws": "Unexpected token (3:9)",
|
||||
"plugins": ["classProperties"]
|
||||
}
|
||||
9
test/fixtures/experimental/class-properties/asi-success/actual.js
vendored
Normal file
9
test/fixtures/experimental/class-properties/asi-success/actual.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
class Foo {
|
||||
x
|
||||
y
|
||||
}
|
||||
|
||||
class Foo {
|
||||
p
|
||||
[m] () {}
|
||||
}
|
||||
289
test/fixtures/experimental/class-properties/asi-success/expected.json
vendored
Normal file
289
test/fixtures/experimental/class-properties/asi-success/expected.json
vendored
Normal file
@ -0,0 +1,289 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start": 0,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"name": "Foo"
|
||||
},
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start": 10,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassProperty",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"computed": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"name": "x"
|
||||
},
|
||||
"static": false,
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"type": "ClassProperty",
|
||||
"start": 18,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"computed": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 18,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"name": "y"
|
||||
},
|
||||
"static": false,
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start": 23,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 29,
|
||||
"end": 32,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"name": "Foo"
|
||||
},
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start": 33,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassProperty",
|
||||
"start": 37,
|
||||
"end": 38,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"computed": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 37,
|
||||
"end": 38,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"name": "p"
|
||||
},
|
||||
"static": false,
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start": 41,
|
||||
"end": 50,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"computed": true,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 42,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"name": "m"
|
||||
},
|
||||
"static": false,
|
||||
"kind": "method",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"expression": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 48,
|
||||
"end": 50,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
test/fixtures/experimental/class-properties/asi-success/options.json
vendored
Normal file
3
test/fixtures/experimental/class-properties/asi-success/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["classProperties"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user