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:
Nick Cameron
2025-03-20 11:06:27 +13:00
committed by GitHub
parent 4b6166dc4f
commit a7e09a89ef
551 changed files with 115788 additions and 275855 deletions

View File

@ -5,11 +5,7 @@ description: Artifact commands function_sketch_with_position.kcl
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"range": [],
"command": {
"type": "edge_lines_visible",
"hidden": false
@ -17,11 +13,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"range": [],
"command": {
"type": "set_scene_units",
"unit": "mm"
@ -29,11 +21,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
@ -42,11 +30,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
@ -55,11 +39,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
31,
50,
0
],
"range": [],
"command": {
"type": "make_plane",
"origin": {
@ -84,11 +64,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
58,
78,
0
],
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
@ -104,22 +80,14 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
58,
78,
0
],
"range": [],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [
58,
78,
0
],
"range": [],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
@ -132,22 +100,14 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
58,
78,
0
],
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
86,
104,
0
],
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
@ -164,11 +124,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
112,
130,
0
],
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
@ -185,11 +141,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
138,
157,
0
],
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
@ -206,11 +158,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
165,
173,
0
],
"range": [],
"command": {
"type": "close_path",
"path_id": "[uuid]"
@ -218,11 +166,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
@ -238,11 +182,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "extrude",
"target": "[uuid]",
@ -252,22 +192,14 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
@ -275,11 +207,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
@ -288,11 +216,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
@ -302,11 +226,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
@ -316,11 +236,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
@ -330,11 +246,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
@ -344,11 +256,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
@ -358,11 +266,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
@ -372,11 +276,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
@ -386,11 +286,7 @@ description: Artifact commands function_sketch_with_position.kcl
},
{
"cmdId": "[uuid]",
"range": [
181,
200,
0
],
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",

View File

@ -7,11 +7,11 @@ description: Result of parsing function_sketch_with_position.kcl
"body": [
{
"declaration": {
"end": 218,
"end": 0,
"id": {
"end": 6,
"end": 0,
"name": "box",
"start": 3,
"start": 0,
"type": "Identifier"
},
"init": {
@ -19,11 +19,11 @@ description: Result of parsing function_sketch_with_position.kcl
"body": [
{
"declaration": {
"end": 200,
"end": 0,
"id": {
"end": 28,
"end": 0,
"name": "myBox",
"start": 23,
"start": 0,
"type": "Identifier"
},
"init": {
@ -31,49 +31,49 @@ description: Result of parsing function_sketch_with_position.kcl
{
"arguments": [
{
"end": 49,
"end": 0,
"raw": "'XY'",
"start": 45,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 44,
"end": 0,
"name": "startSketchOn",
"start": 31,
"start": 0,
"type": "Identifier"
},
"end": 50,
"start": 31,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 74,
"end": 0,
"name": "p",
"start": 73,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 77,
"start": 76,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 72,
"end": 0,
"name": "startProfileAt",
"start": 58,
"start": 0,
"type": "Identifier"
},
"end": 78,
"start": 58,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
@ -82,17 +82,17 @@ description: Result of parsing function_sketch_with_position.kcl
{
"type": "LabeledArg",
"label": {
"end": 94,
"end": 0,
"name": "end",
"start": 91,
"start": 0,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 99,
"end": 0,
"raw": "0",
"start": 98,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -101,28 +101,28 @@ description: Result of parsing function_sketch_with_position.kcl
}
},
{
"end": 102,
"end": 0,
"name": "l",
"start": 101,
"start": 0,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 103,
"start": 97,
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 90,
"end": 0,
"name": "line",
"start": 86,
"start": 0,
"type": "Identifier"
},
"end": 104,
"start": 86,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
@ -132,24 +132,24 @@ description: Result of parsing function_sketch_with_position.kcl
{
"type": "LabeledArg",
"label": {
"end": 120,
"end": 0,
"name": "end",
"start": 117,
"start": 0,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 125,
"end": 0,
"name": "w",
"start": 124,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 128,
"end": 0,
"raw": "0",
"start": 127,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -158,21 +158,21 @@ description: Result of parsing function_sketch_with_position.kcl
}
}
],
"end": 129,
"start": 123,
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 116,
"end": 0,
"name": "line",
"start": 112,
"start": 0,
"type": "Identifier"
},
"end": 130,
"start": 112,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
@ -182,17 +182,17 @@ description: Result of parsing function_sketch_with_position.kcl
{
"type": "LabeledArg",
"label": {
"end": 146,
"end": 0,
"name": "end",
"start": 143,
"start": 0,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 151,
"end": 0,
"raw": "0",
"start": 150,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -202,34 +202,34 @@ description: Result of parsing function_sketch_with_position.kcl
},
{
"argument": {
"end": 155,
"end": 0,
"name": "l",
"start": 154,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"end": 155,
"end": 0,
"operator": "-",
"start": 153,
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 156,
"start": 149,
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 142,
"end": 0,
"name": "line",
"start": 138,
"start": 0,
"type": "Identifier"
},
"end": 157,
"start": 138,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
@ -237,20 +237,20 @@ description: Result of parsing function_sketch_with_position.kcl
{
"arguments": [
{
"end": 172,
"start": 171,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 170,
"end": 0,
"name": "close",
"start": 165,
"start": 0,
"type": "Identifier"
},
"end": 173,
"start": 165,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
@ -259,68 +259,68 @@ description: Result of parsing function_sketch_with_position.kcl
{
"type": "LabeledArg",
"label": {
"end": 195,
"end": 0,
"name": "length",
"start": 189,
"start": 0,
"type": "Identifier"
},
"arg": {
"end": 199,
"end": 0,
"name": "h",
"start": 198,
"start": 0,
"type": "Identifier",
"type": "Identifier"
}
}
],
"callee": {
"end": 188,
"end": 0,
"name": "extrude",
"start": 181,
"start": 0,
"type": "Identifier"
},
"end": 200,
"start": 181,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 200,
"start": 31,
"end": 0,
"start": 0,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 23,
"start": 0,
"type": "VariableDeclarator"
},
"end": 200,
"end": 0,
"kind": "const",
"start": 23,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"argument": {
"end": 216,
"end": 0,
"name": "myBox",
"start": 211,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"end": 216,
"start": 204,
"end": 0,
"start": 0,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 218,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 204,
"start": 200,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
@ -330,55 +330,55 @@ description: Result of parsing function_sketch_with_position.kcl
},
"startNodes": []
},
"start": 19
"start": 0
},
"end": 218,
"end": 0,
"params": [
{
"type": "Parameter",
"identifier": {
"end": 8,
"end": 0,
"name": "p",
"start": 7,
"start": 0,
"type": "Identifier"
}
},
{
"type": "Parameter",
"identifier": {
"end": 11,
"end": 0,
"name": "h",
"start": 10,
"start": 0,
"type": "Identifier"
}
},
{
"type": "Parameter",
"identifier": {
"end": 14,
"end": 0,
"name": "l",
"start": 13,
"start": 0,
"type": "Identifier"
}
},
{
"type": "Parameter",
"identifier": {
"end": 17,
"end": 0,
"name": "w",
"start": 16,
"start": 0,
"type": "Identifier"
}
}
],
"start": 6,
"start": 0,
"type": "FunctionExpression",
"type": "FunctionExpression"
},
"start": 3,
"start": 0,
"type": "VariableDeclarator"
},
"end": 218,
"end": 0,
"kind": "fn",
"start": 0,
"type": "VariableDeclaration",
@ -386,11 +386,11 @@ description: Result of parsing function_sketch_with_position.kcl
},
{
"declaration": {
"end": 249,
"end": 0,
"id": {
"end": 225,
"end": 0,
"name": "thing",
"start": 220,
"start": 0,
"type": "Identifier"
},
"init": {
@ -398,9 +398,9 @@ description: Result of parsing function_sketch_with_position.kcl
{
"elements": [
{
"end": 234,
"end": 0,
"raw": "0",
"start": 233,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -409,9 +409,9 @@ description: Result of parsing function_sketch_with_position.kcl
}
},
{
"end": 237,
"end": 0,
"raw": "0",
"start": 236,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -420,15 +420,15 @@ description: Result of parsing function_sketch_with_position.kcl
}
}
],
"end": 238,
"start": 232,
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 241,
"end": 0,
"raw": "3",
"start": 240,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -437,9 +437,9 @@ description: Result of parsing function_sketch_with_position.kcl
}
},
{
"end": 244,
"end": 0,
"raw": "6",
"start": 243,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -448,9 +448,9 @@ description: Result of parsing function_sketch_with_position.kcl
}
},
{
"end": 248,
"end": 0,
"raw": "10",
"start": 246,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -460,33 +460,33 @@ description: Result of parsing function_sketch_with_position.kcl
}
],
"callee": {
"end": 231,
"end": 0,
"name": "box",
"start": 228,
"start": 0,
"type": "Identifier"
},
"end": 249,
"start": 228,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 220,
"start": 0,
"type": "VariableDeclarator"
},
"end": 249,
"end": 0,
"kind": "const",
"start": 220,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 250,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 220,
"start": 218,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"

View File

@ -13,11 +13,7 @@ description: Operations executed function_sketch_with_position.kcl
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
228,
249,
0
]
"sourceRange": []
},
{
"labeledArgs": {
@ -26,19 +22,11 @@ description: Operations executed function_sketch_with_position.kcl
"type": "String",
"value": "XY"
},
"sourceRange": [
45,
49,
0
]
"sourceRange": []
}
},
"name": "startSketchOn",
"sourceRange": [
31,
50,
0
],
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": null
},
@ -58,19 +46,11 @@ description: Operations executed function_sketch_with_position.kcl
}
}
},
"sourceRange": [
198,
199,
0
]
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [
181,
200,
0
],
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
@ -79,11 +59,7 @@ description: Operations executed function_sketch_with_position.kcl
"artifactId": "[uuid]"
}
},
"sourceRange": [
181,
200,
0
]
"sourceRange": []
}
},
{

View File

@ -16,44 +16,28 @@ description: Variables in memory after executing function_sketch_with_position.k
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
86,
104,
0
],
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
112,
130,
0
],
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
138,
157,
0
],
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
165,
173,
0
],
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
}
@ -65,11 +49,7 @@ description: Variables in memory after executing function_sketch_with_position.k
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
86,
104,
0
]
"sourceRange": []
},
"from": [
0.0,
@ -88,11 +68,7 @@ description: Variables in memory after executing function_sketch_with_position.k
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
112,
130,
0
]
"sourceRange": []
},
"from": [
0.0,
@ -111,11 +87,7 @@ description: Variables in memory after executing function_sketch_with_position.k
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
138,
157,
0
]
"sourceRange": []
},
"from": [
10.0,
@ -134,11 +106,7 @@ description: Variables in memory after executing function_sketch_with_position.k
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
165,
173,
0
]
"sourceRange": []
},
"from": [
10.0,
@ -199,11 +167,7 @@ description: Variables in memory after executing function_sketch_with_position.k
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
58,
78,
0
]
"sourceRange": []
}
},
"artifactId": "[uuid]",

View File

@ -0,0 +1,17 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing function_sketch_with_position.kcl
---
fn box(p, h, l, w) {
myBox = startSketchOn('XY')
|> startProfileAt(p, %)
|> line(end = [0, l])
|> line(end = [w, 0])
|> line(end = [0, -l])
|> close(%)
|> extrude(length = h)
return myBox
}
thing = box([0, 0], 3, 6, 10)