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 array_elem_pop.kcl
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"range": [],
"command": {
"type": "edge_lines_visible",
"hidden": false
@ -17,11 +13,7 @@ description: Artifact commands array_elem_pop.kcl
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"range": [],
"command": {
"type": "set_scene_units",
"unit": "mm"
@ -29,11 +21,7 @@ description: Artifact commands array_elem_pop.kcl
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
@ -42,11 +30,7 @@ description: Artifact commands array_elem_pop.kcl
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",

View File

@ -7,9 +7,9 @@ description: Result of parsing array_elem_pop.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 array_elem_pop.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 array_elem_pop.kcl
}
},
{
"end": 11,
"end": 0,
"raw": "2",
"start": 10,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -39,9 +39,9 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"end": 14,
"end": 0,
"raw": "3",
"start": 13,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -50,15 +50,15 @@ description: Result of parsing array_elem_pop.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,139 +66,139 @@ description: Result of parsing array_elem_pop.kcl
},
{
"declaration": {
"end": 35,
"end": 0,
"id": {
"end": 24,
"end": 0,
"name": "new_arr1",
"start": 16,
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 34,
"end": 0,
"name": "arr",
"start": 31,
"start": 0,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 30,
"end": 0,
"name": "pop",
"start": 27,
"start": 0,
"type": "Identifier"
},
"end": 35,
"start": 27,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 16,
"start": 0,
"type": "VariableDeclarator"
},
"end": 35,
"end": 0,
"kind": "const",
"start": 16,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 60,
"end": 0,
"id": {
"end": 44,
"end": 0,
"name": "new_arr2",
"start": 36,
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 59,
"end": 0,
"name": "new_arr1",
"start": 51,
"start": 0,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 50,
"end": 0,
"name": "pop",
"start": 47,
"start": 0,
"type": "Identifier"
},
"end": 60,
"start": 47,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 36,
"start": 0,
"type": "VariableDeclarator"
},
"end": 60,
"end": 0,
"kind": "const",
"start": 36,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 85,
"end": 0,
"id": {
"end": 69,
"end": 0,
"name": "new_arr3",
"start": 61,
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 84,
"end": 0,
"name": "new_arr2",
"start": 76,
"start": 0,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 75,
"end": 0,
"name": "pop",
"start": 72,
"start": 0,
"type": "Identifier"
},
"end": 85,
"start": 72,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 61,
"start": 0,
"type": "VariableDeclarator"
},
"end": 85,
"end": 0,
"kind": "const",
"start": 61,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 159,
"end": 0,
"expression": {
"arguments": [
{
"computed": false,
"end": 109,
"end": 0,
"object": {
"end": 106,
"end": 0,
"name": "new_arr1",
"start": 98,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 108,
"end": 0,
"raw": "0",
"start": 107,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -206,14 +206,14 @@ description: Result of parsing array_elem_pop.kcl
"suffix": "None"
}
},
"start": 98,
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 112,
"end": 0,
"raw": "1",
"start": 111,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -222,9 +222,9 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"end": 121,
"end": 0,
"raw": "0.00001",
"start": 114,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -233,47 +233,47 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"end": 158,
"end": 0,
"raw": "\"element 0 should not have changed\"",
"start": 123,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "element 0 should not have changed"
}
],
"callee": {
"end": 97,
"end": 0,
"name": "assertEqual",
"start": 86,
"start": 0,
"type": "Identifier"
},
"end": 159,
"start": 86,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 86,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 233,
"end": 0,
"expression": {
"arguments": [
{
"computed": false,
"end": 183,
"end": 0,
"object": {
"end": 180,
"end": 0,
"name": "new_arr1",
"start": 172,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 182,
"end": 0,
"raw": "1",
"start": 181,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -281,14 +281,14 @@ description: Result of parsing array_elem_pop.kcl
"suffix": "None"
}
},
"start": 172,
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 186,
"end": 0,
"raw": "2",
"start": 185,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -297,9 +297,9 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"end": 195,
"end": 0,
"raw": "0.00001",
"start": 188,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -308,47 +308,47 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"end": 232,
"end": 0,
"raw": "\"element 1 should not have changed\"",
"start": 197,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "element 1 should not have changed"
}
],
"callee": {
"end": 171,
"end": 0,
"name": "assertEqual",
"start": 160,
"start": 0,
"type": "Identifier"
},
"end": 233,
"start": 160,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 160,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 307,
"end": 0,
"expression": {
"arguments": [
{
"computed": false,
"end": 257,
"end": 0,
"object": {
"end": 254,
"end": 0,
"name": "new_arr2",
"start": 246,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 256,
"end": 0,
"raw": "0",
"start": 255,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -356,14 +356,14 @@ description: Result of parsing array_elem_pop.kcl
"suffix": "None"
}
},
"start": 246,
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 260,
"end": 0,
"raw": "1",
"start": 259,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -372,9 +372,9 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"end": 269,
"end": 0,
"raw": "0.00001",
"start": 262,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -383,31 +383,31 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"end": 306,
"end": 0,
"raw": "\"element 0 should not have changed\"",
"start": 271,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "element 0 should not have changed"
}
],
"callee": {
"end": 245,
"end": 0,
"name": "assertEqual",
"start": 234,
"start": 0,
"type": "Identifier"
},
"end": 307,
"start": 234,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 234,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 308,
"end": 0,
"start": 0
}
}

View File

@ -0,0 +1,11 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing array_elem_pop.kcl
---
arr = [1, 2, 3]
new_arr1 = pop(arr)
new_arr2 = pop(new_arr1)
new_arr3 = pop(new_arr2)
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")