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

@ -1,5 +1,5 @@
---
source: kcl/src/simulation_tests.rs
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing boolean_logical_and.kcl
---
{
@ -7,40 +7,40 @@ description: Result of parsing boolean_logical_and.kcl
"body": [
{
"declaration": {
"end": 17,
"end": 0,
"id": {
"end": 2,
"end": 0,
"name": "aa",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 17,
"end": 0,
"left": {
"end": 9,
"end": 0,
"raw": "true",
"start": 5,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": true
},
"operator": "&",
"right": {
"end": 17,
"end": 0,
"raw": "false",
"start": 12,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": false
},
"start": 5,
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 17,
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
@ -48,32 +48,32 @@ description: Result of parsing boolean_logical_and.kcl
},
{
"declaration": {
"end": 48,
"end": 0,
"id": {
"end": 19,
"end": 0,
"name": "a",
"start": 18,
"start": 0,
"type": "Identifier"
},
"init": {
"cond": {
"end": 27,
"end": 0,
"name": "aa",
"start": 25,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 48,
"end": 0,
"final_else": {
"body": [
{
"end": 46,
"end": 0,
"expression": {
"end": 46,
"end": 0,
"raw": "2",
"start": 45,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -81,23 +81,23 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 45,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 47,
"start": 45
"end": 0,
"start": 0
},
"start": 22,
"start": 0,
"then_val": {
"body": [
{
"end": 33,
"end": 0,
"expression": {
"end": 33,
"end": 0,
"raw": "1",
"start": 32,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -105,44 +105,44 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 32,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 34,
"start": 32
"end": 0,
"start": 0
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 18,
"start": 0,
"type": "VariableDeclarator"
},
"end": 48,
"end": 0,
"kind": "const",
"start": 18,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 128,
"end": 0,
"expression": {
"arguments": [
{
"end": 62,
"end": 0,
"left": {
"end": 57,
"end": 0,
"name": "a",
"start": 56,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 62,
"end": 0,
"raw": "2",
"start": 61,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -150,103 +150,103 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 56,
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 127,
"end": 0,
"raw": "\"right branch of and is false makes the whole expression false\"",
"start": 64,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "right branch of and is false makes the whole expression false"
}
],
"callee": {
"end": 55,
"end": 0,
"name": "assert",
"start": 49,
"start": 0,
"type": "Identifier"
},
"end": 128,
"start": 49,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 49,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 147,
"end": 0,
"id": {
"end": 132,
"end": 0,
"name": "bb",
"start": 130,
"start": 0,
"type": "Identifier"
},
"init": {
"end": 147,
"end": 0,
"left": {
"end": 140,
"end": 0,
"raw": "false",
"start": 135,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": false
},
"operator": "&",
"right": {
"end": 147,
"end": 0,
"raw": "true",
"start": 143,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": true
},
"start": 135,
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 130,
"start": 0,
"type": "VariableDeclarator"
},
"end": 147,
"end": 0,
"kind": "const",
"start": 130,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 178,
"end": 0,
"id": {
"end": 149,
"end": 0,
"name": "b",
"start": 148,
"start": 0,
"type": "Identifier"
},
"init": {
"cond": {
"end": 157,
"end": 0,
"name": "bb",
"start": 155,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 178,
"end": 0,
"final_else": {
"body": [
{
"end": 176,
"end": 0,
"expression": {
"end": 176,
"end": 0,
"raw": "2",
"start": 175,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -254,23 +254,23 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 175,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 177,
"start": 175
"end": 0,
"start": 0
},
"start": 152,
"start": 0,
"then_val": {
"body": [
{
"end": 163,
"end": 0,
"expression": {
"end": 163,
"end": 0,
"raw": "1",
"start": 162,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -278,44 +278,44 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 162,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 164,
"start": 162
"end": 0,
"start": 0
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 148,
"start": 0,
"type": "VariableDeclarator"
},
"end": 178,
"end": 0,
"kind": "const",
"start": 148,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 257,
"end": 0,
"expression": {
"arguments": [
{
"end": 192,
"end": 0,
"left": {
"end": 187,
"end": 0,
"name": "b",
"start": 186,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 192,
"end": 0,
"raw": "2",
"start": 191,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -323,103 +323,103 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 186,
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 256,
"end": 0,
"raw": "\"left branch of and is false makes the whole expression false\"",
"start": 194,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "left branch of and is false makes the whole expression false"
}
],
"callee": {
"end": 185,
"end": 0,
"name": "assert",
"start": 179,
"start": 0,
"type": "Identifier"
},
"end": 257,
"start": 179,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 179,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 275,
"end": 0,
"id": {
"end": 261,
"end": 0,
"name": "cc",
"start": 259,
"start": 0,
"type": "Identifier"
},
"init": {
"end": 275,
"end": 0,
"left": {
"end": 268,
"end": 0,
"raw": "true",
"start": 264,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": true
},
"operator": "&",
"right": {
"end": 275,
"end": 0,
"raw": "true",
"start": 271,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": true
},
"start": 264,
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 259,
"start": 0,
"type": "VariableDeclarator"
},
"end": 275,
"end": 0,
"kind": "const",
"start": 259,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 306,
"end": 0,
"id": {
"end": 277,
"end": 0,
"name": "c",
"start": 276,
"start": 0,
"type": "Identifier"
},
"init": {
"cond": {
"end": 285,
"end": 0,
"name": "cc",
"start": 283,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 306,
"end": 0,
"final_else": {
"body": [
{
"end": 304,
"end": 0,
"expression": {
"end": 304,
"end": 0,
"raw": "2",
"start": 303,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -427,23 +427,23 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 303,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 305,
"start": 303
"end": 0,
"start": 0
},
"start": 280,
"start": 0,
"then_val": {
"body": [
{
"end": 291,
"end": 0,
"expression": {
"end": 291,
"end": 0,
"raw": "1",
"start": 290,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -451,44 +451,44 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 290,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 292,
"start": 290
"end": 0,
"start": 0
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 276,
"start": 0,
"type": "VariableDeclarator"
},
"end": 306,
"end": 0,
"kind": "const",
"start": 276,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 386,
"end": 0,
"expression": {
"arguments": [
{
"end": 320,
"end": 0,
"left": {
"end": 315,
"end": 0,
"name": "c",
"start": 314,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 320,
"end": 0,
"raw": "1",
"start": 319,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -496,103 +496,103 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 314,
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 385,
"end": 0,
"raw": "\"both branches of and are true makes the whole expression true\"",
"start": 322,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are true makes the whole expression true"
}
],
"callee": {
"end": 313,
"end": 0,
"name": "assert",
"start": 307,
"start": 0,
"type": "Identifier"
},
"end": 386,
"start": 307,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 307,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 406,
"end": 0,
"id": {
"end": 390,
"end": 0,
"name": "dd",
"start": 388,
"start": 0,
"type": "Identifier"
},
"init": {
"end": 406,
"end": 0,
"left": {
"end": 398,
"end": 0,
"raw": "false",
"start": 393,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": false
},
"operator": "&",
"right": {
"end": 406,
"end": 0,
"raw": "false",
"start": 401,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": false
},
"start": 393,
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 388,
"start": 0,
"type": "VariableDeclarator"
},
"end": 406,
"end": 0,
"kind": "const",
"start": 388,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 437,
"end": 0,
"id": {
"end": 408,
"end": 0,
"name": "d",
"start": 407,
"start": 0,
"type": "Identifier"
},
"init": {
"cond": {
"end": 416,
"end": 0,
"name": "dd",
"start": 414,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 437,
"end": 0,
"final_else": {
"body": [
{
"end": 435,
"end": 0,
"expression": {
"end": 435,
"end": 0,
"raw": "2",
"start": 434,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -600,23 +600,23 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 434,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 436,
"start": 434
"end": 0,
"start": 0
},
"start": 411,
"start": 0,
"then_val": {
"body": [
{
"end": 422,
"end": 0,
"expression": {
"end": 422,
"end": 0,
"raw": "1",
"start": 421,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -624,44 +624,44 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 421,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 423,
"start": 421
"end": 0,
"start": 0
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 407,
"start": 0,
"type": "VariableDeclarator"
},
"end": 437,
"end": 0,
"kind": "const",
"start": 407,
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 519,
"end": 0,
"expression": {
"arguments": [
{
"end": 451,
"end": 0,
"left": {
"end": 446,
"end": 0,
"name": "d",
"start": 445,
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 451,
"end": 0,
"raw": "2",
"start": 450,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
@ -669,42 +669,42 @@ description: Result of parsing boolean_logical_and.kcl
"suffix": "None"
}
},
"start": 445,
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 518,
"end": 0,
"raw": "\"both branches of and are false makes the whole expression false\"",
"start": 453,
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are false makes the whole expression false"
}
],
"callee": {
"end": 444,
"end": 0,
"name": "assert",
"start": 438,
"start": 0,
"type": "Identifier"
},
"end": 519,
"start": 438,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 438,
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 520,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"2": [
{
"end": 130,
"start": 128,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
@ -713,8 +713,8 @@ description: Result of parsing boolean_logical_and.kcl
],
"5": [
{
"end": 259,
"start": 257,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
@ -723,8 +723,8 @@ description: Result of parsing boolean_logical_and.kcl
],
"8": [
{
"end": 388,
"start": 386,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"