Improve snapshot testing (#5856)
* Improve snapshot testing Signed-off-by: Nick Cameron <nrc@ncameron.org> * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -5,11 +5,7 @@ description: Artifact commands invalid_index_negative.kcl
|
||||
[
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "edge_lines_visible",
|
||||
"hidden": false
|
||||
@ -17,11 +13,7 @@ description: Artifact commands invalid_index_negative.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "set_scene_units",
|
||||
"unit": "mm"
|
||||
@ -29,11 +21,7 @@ description: Artifact commands invalid_index_negative.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
@ -42,11 +30,7 @@ description: Artifact commands invalid_index_negative.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Result of parsing invalid_index_negative.kcl
|
||||
---
|
||||
{
|
||||
@ -7,9 +7,9 @@ description: Result of parsing invalid_index_negative.kcl
|
||||
"body": [
|
||||
{
|
||||
"declaration": {
|
||||
"end": 15,
|
||||
"end": 0,
|
||||
"id": {
|
||||
"end": 3,
|
||||
"end": 0,
|
||||
"name": "arr",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
@ -17,9 +17,9 @@ description: Result of parsing invalid_index_negative.kcl
|
||||
"init": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 8,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 7,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -28,9 +28,9 @@ description: Result of parsing invalid_index_negative.kcl
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 11,
|
||||
"end": 0,
|
||||
"raw": "2",
|
||||
"start": 10,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -39,9 +39,9 @@ description: Result of parsing invalid_index_negative.kcl
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 14,
|
||||
"end": 0,
|
||||
"raw": "3",
|
||||
"start": 13,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -50,15 +50,15 @@ description: Result of parsing invalid_index_negative.kcl
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 15,
|
||||
"start": 6,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 15,
|
||||
"end": 0,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
@ -66,18 +66,18 @@ description: Result of parsing invalid_index_negative.kcl
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 22,
|
||||
"end": 0,
|
||||
"id": {
|
||||
"end": 17,
|
||||
"end": 0,
|
||||
"name": "i",
|
||||
"start": 16,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"argument": {
|
||||
"end": 22,
|
||||
"end": 0,
|
||||
"raw": "1",
|
||||
"start": 21,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -85,62 +85,62 @@ description: Result of parsing invalid_index_negative.kcl
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"end": 22,
|
||||
"end": 0,
|
||||
"operator": "-",
|
||||
"start": 20,
|
||||
"start": 0,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
},
|
||||
"start": 16,
|
||||
"start": 0,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 22,
|
||||
"end": 0,
|
||||
"kind": "const",
|
||||
"start": 16,
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 33,
|
||||
"end": 0,
|
||||
"id": {
|
||||
"end": 24,
|
||||
"end": 0,
|
||||
"name": "x",
|
||||
"start": 23,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"computed": true,
|
||||
"end": 33,
|
||||
"end": 0,
|
||||
"object": {
|
||||
"end": 30,
|
||||
"end": 0,
|
||||
"name": "arr",
|
||||
"start": 27,
|
||||
"start": 0,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"property": {
|
||||
"end": 32,
|
||||
"end": 0,
|
||||
"name": "i",
|
||||
"start": 31,
|
||||
"start": 0,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 27,
|
||||
"start": 0,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
"start": 23,
|
||||
"start": 0,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 33,
|
||||
"end": 0,
|
||||
"kind": "const",
|
||||
"start": 23,
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 34,
|
||||
"end": 0,
|
||||
"start": 0
|
||||
}
|
||||
}
|
||||
|
||||
7
rust/kcl-lib/tests/invalid_index_negative/unparsed.snap
Normal file
7
rust/kcl-lib/tests/invalid_index_negative/unparsed.snap
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Result of unparsing invalid_index_negative.kcl
|
||||
---
|
||||
arr = [1, 2, 3]
|
||||
i = -1
|
||||
x = arr[i]
|
||||
Reference in New Issue
Block a user