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 helix_simple.kcl
|
||||
[
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "edge_lines_visible",
|
||||
"hidden": false
|
||||
@ -17,11 +13,7 @@ description: Artifact commands helix_simple.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "set_scene_units",
|
||||
"unit": "mm"
|
||||
@ -29,11 +21,7 @@ description: Artifact commands helix_simple.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
@ -42,11 +30,7 @@ description: Artifact commands helix_simple.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
@ -55,11 +39,7 @@ description: Artifact commands helix_simple.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
46,
|
||||
65,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
@ -84,11 +64,7 @@ description: Artifact commands helix_simple.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
71,
|
||||
96,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "enable_sketch_mode",
|
||||
"entity_id": "[uuid]",
|
||||
@ -104,22 +80,14 @@ description: Artifact commands helix_simple.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
71,
|
||||
96,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "start_path"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
71,
|
||||
96,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "move_path_pen",
|
||||
"path": "[uuid]",
|
||||
@ -132,22 +100,14 @@ description: Artifact commands helix_simple.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
71,
|
||||
96,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "sketch_mode_disable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
102,
|
||||
137,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "extend_path",
|
||||
"path": "[uuid]",
|
||||
@ -164,11 +124,7 @@ description: Artifact commands helix_simple.kcl
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
151,
|
||||
257,
|
||||
0
|
||||
],
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "entity_make_helix_from_edge",
|
||||
"radius": 5.0,
|
||||
|
||||
@ -7,11 +7,11 @@ description: Result of parsing helix_simple.kcl
|
||||
"body": [
|
||||
{
|
||||
"declaration": {
|
||||
"end": 137,
|
||||
"end": 0,
|
||||
"id": {
|
||||
"end": 43,
|
||||
"end": 0,
|
||||
"name": "helper001",
|
||||
"start": 34,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
@ -19,22 +19,22 @@ description: Result of parsing helix_simple.kcl
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 64,
|
||||
"end": 0,
|
||||
"raw": "'XZ'",
|
||||
"start": 60,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "XZ"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 59,
|
||||
"end": 0,
|
||||
"name": "startSketchOn",
|
||||
"start": 46,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 65,
|
||||
"start": 46,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
@ -43,9 +43,9 @@ description: Result of parsing helix_simple.kcl
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 88,
|
||||
"end": 0,
|
||||
"raw": "0",
|
||||
"start": 87,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -54,9 +54,9 @@ description: Result of parsing helix_simple.kcl
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 91,
|
||||
"end": 0,
|
||||
"raw": "0",
|
||||
"start": 90,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -65,26 +65,26 @@ description: Result of parsing helix_simple.kcl
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 92,
|
||||
"start": 86,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 95,
|
||||
"start": 94,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 85,
|
||||
"end": 0,
|
||||
"name": "startProfileAt",
|
||||
"start": 71,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 96,
|
||||
"start": 71,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
@ -93,17 +93,17 @@ description: Result of parsing helix_simple.kcl
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"end": 110,
|
||||
"end": 0,
|
||||
"name": "end",
|
||||
"start": 107,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 115,
|
||||
"end": 0,
|
||||
"raw": "0",
|
||||
"start": 114,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -112,9 +112,9 @@ description: Result of parsing helix_simple.kcl
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 119,
|
||||
"end": 0,
|
||||
"raw": "10",
|
||||
"start": 117,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -123,8 +123,8 @@ description: Result of parsing helix_simple.kcl
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 120,
|
||||
"start": 113,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
@ -132,14 +132,14 @@ description: Result of parsing helix_simple.kcl
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"end": 125,
|
||||
"end": 0,
|
||||
"name": "tag",
|
||||
"start": 122,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"end": 136,
|
||||
"start": 128,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "TagDeclarator",
|
||||
"type": "TagDeclarator",
|
||||
"value": "edge001"
|
||||
@ -147,39 +147,39 @@ description: Result of parsing helix_simple.kcl
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 106,
|
||||
"end": 0,
|
||||
"name": "line",
|
||||
"start": 102,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 137,
|
||||
"start": 102,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": null
|
||||
}
|
||||
],
|
||||
"end": 137,
|
||||
"start": 46,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 34,
|
||||
"start": 0,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 137,
|
||||
"end": 0,
|
||||
"kind": "const",
|
||||
"start": 34,
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 257,
|
||||
"end": 0,
|
||||
"id": {
|
||||
"end": 148,
|
||||
"end": 0,
|
||||
"name": "helixPath",
|
||||
"start": 139,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
@ -187,15 +187,15 @@ description: Result of parsing helix_simple.kcl
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"end": 170,
|
||||
"end": 0,
|
||||
"name": "angleStart",
|
||||
"start": 160,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"end": 174,
|
||||
"end": 0,
|
||||
"raw": "0",
|
||||
"start": 173,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -207,15 +207,15 @@ description: Result of parsing helix_simple.kcl
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"end": 181,
|
||||
"end": 0,
|
||||
"name": "ccw",
|
||||
"start": 178,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"end": 188,
|
||||
"end": 0,
|
||||
"raw": "true",
|
||||
"start": 184,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": true
|
||||
@ -224,15 +224,15 @@ description: Result of parsing helix_simple.kcl
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"end": 203,
|
||||
"end": 0,
|
||||
"name": "revolutions",
|
||||
"start": 192,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"end": 207,
|
||||
"end": 0,
|
||||
"raw": "5",
|
||||
"start": 206,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -244,15 +244,15 @@ description: Result of parsing helix_simple.kcl
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"end": 217,
|
||||
"end": 0,
|
||||
"name": "length",
|
||||
"start": 211,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"end": 222,
|
||||
"end": 0,
|
||||
"raw": "10",
|
||||
"start": 220,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -264,15 +264,15 @@ description: Result of parsing helix_simple.kcl
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"end": 232,
|
||||
"end": 0,
|
||||
"name": "radius",
|
||||
"start": 226,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"end": 236,
|
||||
"end": 0,
|
||||
"raw": "5",
|
||||
"start": 235,
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
@ -284,49 +284,49 @@ description: Result of parsing helix_simple.kcl
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"end": 244,
|
||||
"end": 0,
|
||||
"name": "axis",
|
||||
"start": 240,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"end": 254,
|
||||
"end": 0,
|
||||
"name": "edge001",
|
||||
"start": 247,
|
||||
"start": 0,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 156,
|
||||
"end": 0,
|
||||
"name": "helix",
|
||||
"start": 151,
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 257,
|
||||
"start": 151,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": null
|
||||
},
|
||||
"start": 139,
|
||||
"start": 0,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 257,
|
||||
"end": 0,
|
||||
"kind": "const",
|
||||
"start": 139,
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 258,
|
||||
"end": 0,
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"0": [
|
||||
{
|
||||
"end": 139,
|
||||
"start": 137,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLine"
|
||||
@ -336,7 +336,7 @@ description: Result of parsing helix_simple.kcl
|
||||
},
|
||||
"startNodes": [
|
||||
{
|
||||
"end": 33,
|
||||
"end": 0,
|
||||
"start": 0,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Operations executed helix_simple.kcl
|
||||
---
|
||||
[
|
||||
@ -10,19 +10,11 @@ description: Operations executed helix_simple.kcl
|
||||
"type": "String",
|
||||
"value": "XZ"
|
||||
},
|
||||
"sourceRange": [
|
||||
60,
|
||||
64,
|
||||
0
|
||||
]
|
||||
"sourceRange": []
|
||||
}
|
||||
},
|
||||
"name": "startSketchOn",
|
||||
"sourceRange": [
|
||||
46,
|
||||
65,
|
||||
0
|
||||
],
|
||||
"sourceRange": [],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": null
|
||||
},
|
||||
@ -42,11 +34,7 @@ description: Operations executed helix_simple.kcl
|
||||
}
|
||||
}
|
||||
},
|
||||
"sourceRange": [
|
||||
173,
|
||||
174,
|
||||
0
|
||||
]
|
||||
"sourceRange": []
|
||||
},
|
||||
"axis": {
|
||||
"value": {
|
||||
@ -54,22 +42,14 @@ description: Operations executed helix_simple.kcl
|
||||
"value": "edge001",
|
||||
"artifact_id": "[uuid]"
|
||||
},
|
||||
"sourceRange": [
|
||||
247,
|
||||
254,
|
||||
0
|
||||
]
|
||||
"sourceRange": []
|
||||
},
|
||||
"ccw": {
|
||||
"value": {
|
||||
"type": "Bool",
|
||||
"value": true
|
||||
},
|
||||
"sourceRange": [
|
||||
184,
|
||||
188,
|
||||
0
|
||||
]
|
||||
"sourceRange": []
|
||||
},
|
||||
"length": {
|
||||
"value": {
|
||||
@ -85,11 +65,7 @@ description: Operations executed helix_simple.kcl
|
||||
}
|
||||
}
|
||||
},
|
||||
"sourceRange": [
|
||||
220,
|
||||
222,
|
||||
0
|
||||
]
|
||||
"sourceRange": []
|
||||
},
|
||||
"radius": {
|
||||
"value": {
|
||||
@ -105,11 +81,7 @@ description: Operations executed helix_simple.kcl
|
||||
}
|
||||
}
|
||||
},
|
||||
"sourceRange": [
|
||||
235,
|
||||
236,
|
||||
0
|
||||
]
|
||||
"sourceRange": []
|
||||
},
|
||||
"revolutions": {
|
||||
"value": {
|
||||
@ -125,19 +97,11 @@ description: Operations executed helix_simple.kcl
|
||||
}
|
||||
}
|
||||
},
|
||||
"sourceRange": [
|
||||
206,
|
||||
207,
|
||||
0
|
||||
]
|
||||
"sourceRange": []
|
||||
}
|
||||
},
|
||||
"name": "helix",
|
||||
"sourceRange": [
|
||||
151,
|
||||
257,
|
||||
0
|
||||
],
|
||||
"sourceRange": [],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": null
|
||||
}
|
||||
|
||||
@ -30,11 +30,7 @@ description: Variables in memory after executing helix_simple.kcl
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
102,
|
||||
137,
|
||||
0
|
||||
]
|
||||
"sourceRange": []
|
||||
},
|
||||
"from": [
|
||||
0.0,
|
||||
@ -100,11 +96,7 @@ description: Variables in memory after executing helix_simple.kcl
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
71,
|
||||
96,
|
||||
0
|
||||
]
|
||||
"sourceRange": []
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
|
||||
17
rust/kcl-lib/tests/helix_simple/unparsed.snap
Normal file
17
rust/kcl-lib/tests/helix_simple/unparsed.snap
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Result of unparsing helix_simple.kcl
|
||||
---
|
||||
// Create a helix around an edge.
|
||||
helper001 = startSketchOn('XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [0, 10], tag = $edge001)
|
||||
|
||||
helixPath = helix(
|
||||
angleStart = 0,
|
||||
ccw = true,
|
||||
revolutions = 5,
|
||||
length = 10,
|
||||
radius = 5,
|
||||
axis = edge001,
|
||||
)
|
||||
Reference in New Issue
Block a user