Files
modeling-app/rust/kcl-lib/tests/kcl_samples/hex-nut/ast.snap
Jonathan Tran 69553fded7 test: Vendor kcl-samples and add simulation tests for them (#5460)
* Change to unzip

* Download kcl-samples as zip to public dir

* Fix fetch:samples, e2e electron still not working

* Change error message to be clearer

* Refactor so that input and output directories of sim tests can be different

* Add kcl samples test implementation

* Update output since adding kcl_samples tests

* Update kcl-samples branch

* Fix git-ignore pattern to only apply to the root

* Fix yarn install and yarn fetch:samples to work the first time

* Remove unneeded exists check

* Change to use kcl-samples in public directory

* Add kcl-samples

* Update output since updating kcl-samples

* Update output files

* Change to not fetch samples during yarn install

* Update output after merge

* Ignore kcl-samples in codespell

* WIP: Don't run e2e if only kcl-samples changed

* Conditionally run cargo tests

* Fix to round floating point values in program memory arrays

* Update output since merge and rounding numbers in memory

* Fix memory redaction for floating point to find more values

* Fix float redaction pattern

* Update output since rounding floating point numbers

* Add center to floating point pattern

* Fix trigger to use picomatch syntax

* Update output since rounding center

* Remove kcl-samples github workflows

* Enable Rust backtrace

* Update output after re-running

* Update output after changing order of post-extrude commands

* Fix to have deterministic order of commands

* Update output after reverting ordering changes

* Update kcl-samples

* Update output after updating samples

* Fix error messages to show the names of all samples that failed

* Change cargo test command to match current one

* Update kcl-samples

* Update output since updating kcl-samples

* Add generate manifest workflow and yarn script

* Fix error check to actually work

* Change util function to be what we actually need

* Move new files after merge

* Fix paths since directory move

* Add dependabot updates for kcl-samples

* Add GitHub workflow to make PR to kcl-samples repo

* Add GitHub workflow to check kcl-samples header comments

* Fix worfklow to change to the right directory

* Add auto-commit simulation test output changes

* Add permissions to workflows

* Fix to run git commit step

* Install just if needed

* Fix directory of justfile

* Add installation of cargo-insta

* Fix to use underscore

* Fix to allow just command failure

* Change to always install CLI tools and cache them

* Trying to fix overwrite failing

* Combine commands

* Change reviewer

* Change to PR targeting the next branch

* Change git commands to not do unnecessary fetch

* Comment out trigger for creating a PR

* Update kcl-samples from next branch

* Update outputs after kcl-samples change

* Fix to use bash pipefail

* Add rust backtrace

* Print full env from sim tests

* Change command to use long option name

* Fix to use ci profile even when calling through just

* Add INSTA_UPDATE=always

* Fix git push by using an app token on checkout

* Add comments

* Fix to use bash options

* Change to echo when no changes are found

* Fix so that kcl-samples updates don't trigger full run

* Fix paths to reflect new crate location

* Fix path detection

* Fix e2e job to ignore kcl_samples simulation test output

* Fix the fetch logic for the KCL samples after vendoring (#5661)

Fixes the last 2 E2E tests for #5460.

---------

Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
2025-03-06 18:01:24 -05:00

1033 lines
39 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing hex-nut.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 419,
"id": {
"end": 413,
"name": "wallToWallLength",
"start": 397,
"type": "Identifier"
},
"init": {
"end": 419,
"raw": "0.5",
"start": 416,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
},
"start": 397,
"type": "VariableDeclarator"
},
"end": 419,
"kind": "const",
"start": 397,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 437,
"id": {
"end": 429,
"name": "thickness",
"start": 420,
"type": "Identifier"
},
"init": {
"end": 437,
"raw": "0.266",
"start": 432,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.266,
"suffix": "None"
}
},
"start": 420,
"type": "VariableDeclarator"
},
"end": 437,
"kind": "const",
"start": 420,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 455,
"id": {
"end": 446,
"name": "diameter",
"start": 438,
"type": "Identifier"
},
"init": {
"end": 455,
"raw": "0.3125",
"start": 449,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.3125,
"suffix": "None"
}
},
"start": 438,
"type": "VariableDeclarator"
},
"end": 455,
"kind": "const",
"start": 438,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 1083,
"id": {
"end": 503,
"name": "hexNut",
"start": 497,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"declaration": {
"end": 1059,
"id": {
"end": 542,
"name": "hexNutSketch",
"start": 530,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 564,
"raw": "'-XZ'",
"start": 559,
"type": "Literal",
"type": "Literal",
"value": "-XZ"
}
],
"callee": {
"end": 558,
"name": "startSketchOn",
"start": 545,
"type": "Identifier"
},
"end": 565,
"start": 545,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 608,
"left": {
"computed": false,
"end": 597,
"object": {
"end": 594,
"name": "start",
"start": 589,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 596,
"raw": "0",
"start": 595,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 589,
"type": "MemberExpression",
"type": "MemberExpression"
},
"operator": "+",
"right": {
"end": 608,
"name": "innerDia",
"start": 600,
"type": "Identifier",
"type": "Identifier"
},
"start": 589,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"computed": false,
"end": 618,
"object": {
"end": 615,
"name": "start",
"start": 610,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 617,
"raw": "1",
"start": 616,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 610,
"type": "MemberExpression",
"type": "MemberExpression"
}
],
"end": 619,
"start": 588,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 622,
"start": 621,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 587,
"name": "startProfileAt",
"start": 573,
"type": "Identifier"
},
"end": 623,
"start": 573,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 676,
"properties": [
{
"end": 655,
"key": {
"end": 649,
"name": "angle",
"start": 644,
"type": "Identifier"
},
"start": 644,
"type": "ObjectProperty",
"value": {
"end": 655,
"raw": "240",
"start": 652,
"type": "Literal",
"type": "Literal",
"value": {
"value": 240.0,
"suffix": "None"
}
}
},
{
"end": 674,
"key": {
"end": 663,
"name": "length",
"start": 657,
"type": "Identifier"
},
"start": 657,
"type": "ObjectProperty",
"value": {
"end": 674,
"name": "innerDia",
"start": 666,
"type": "Identifier",
"type": "Identifier"
}
}
],
"start": 642,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 679,
"start": 678,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 641,
"name": "angledLine",
"start": 631,
"type": "Identifier"
},
"end": 680,
"start": 631,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 733,
"properties": [
{
"end": 712,
"key": {
"end": 706,
"name": "angle",
"start": 701,
"type": "Identifier"
},
"start": 701,
"type": "ObjectProperty",
"value": {
"end": 712,
"raw": "180",
"start": 709,
"type": "Literal",
"type": "Literal",
"value": {
"value": 180.0,
"suffix": "None"
}
}
},
{
"end": 731,
"key": {
"end": 720,
"name": "length",
"start": 714,
"type": "Identifier"
},
"start": 714,
"type": "ObjectProperty",
"value": {
"end": 731,
"name": "innerDia",
"start": 723,
"type": "Identifier",
"type": "Identifier"
}
}
],
"start": 699,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 736,
"start": 735,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 698,
"name": "angledLine",
"start": 688,
"type": "Identifier"
},
"end": 737,
"start": 688,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 790,
"properties": [
{
"end": 769,
"key": {
"end": 763,
"name": "angle",
"start": 758,
"type": "Identifier"
},
"start": 758,
"type": "ObjectProperty",
"value": {
"end": 769,
"raw": "120",
"start": 766,
"type": "Literal",
"type": "Literal",
"value": {
"value": 120.0,
"suffix": "None"
}
}
},
{
"end": 788,
"key": {
"end": 777,
"name": "length",
"start": 771,
"type": "Identifier"
},
"start": 771,
"type": "ObjectProperty",
"value": {
"end": 788,
"name": "innerDia",
"start": 780,
"type": "Identifier",
"type": "Identifier"
}
}
],
"start": 756,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 793,
"start": 792,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 755,
"name": "angledLine",
"start": 745,
"type": "Identifier"
},
"end": 794,
"start": 745,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 846,
"properties": [
{
"end": 825,
"key": {
"end": 820,
"name": "angle",
"start": 815,
"type": "Identifier"
},
"start": 815,
"type": "ObjectProperty",
"value": {
"end": 825,
"raw": "60",
"start": 823,
"type": "Literal",
"type": "Literal",
"value": {
"value": 60.0,
"suffix": "None"
}
}
},
{
"end": 844,
"key": {
"end": 833,
"name": "length",
"start": 827,
"type": "Identifier"
},
"start": 827,
"type": "ObjectProperty",
"value": {
"end": 844,
"name": "innerDia",
"start": 836,
"type": "Identifier",
"type": "Identifier"
}
}
],
"start": 813,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 849,
"start": 848,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 812,
"name": "angledLine",
"start": 802,
"type": "Identifier"
},
"end": 850,
"start": 802,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 907,
"properties": [
{
"end": 880,
"key": {
"end": 876,
"name": "angle",
"start": 871,
"type": "Identifier"
},
"start": 871,
"type": "ObjectProperty",
"value": {
"end": 880,
"raw": "0",
"start": 879,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
},
{
"end": 905,
"key": {
"end": 888,
"name": "length",
"start": 882,
"type": "Identifier"
},
"start": 882,
"type": "ObjectProperty",
"value": {
"end": 905,
"left": {
"end": 899,
"name": "innerDia",
"start": 891,
"type": "Identifier",
"type": "Identifier"
},
"operator": "*",
"right": {
"end": 905,
"raw": ".90",
"start": 902,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.9,
"suffix": "None"
}
},
"start": 891,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
}
],
"start": 869,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 910,
"start": 909,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 868,
"name": "angledLine",
"start": 858,
"type": "Identifier"
},
"end": 911,
"start": 858,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [],
"callee": {
"end": 924,
"name": "close",
"start": 919,
"type": "Identifier"
},
"end": 926,
"start": 919,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 962,
"name": "center",
"start": 956,
"type": "Identifier"
},
"arg": {
"elements": [
{
"computed": false,
"end": 974,
"object": {
"end": 971,
"name": "start",
"start": 966,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 973,
"raw": "0",
"start": 972,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 966,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"computed": false,
"end": 984,
"object": {
"end": 981,
"name": "start",
"start": 976,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 983,
"raw": "1",
"start": 982,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 976,
"type": "MemberExpression",
"type": "MemberExpression"
}
],
"end": 985,
"start": 965,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"type": "LabeledArg",
"label": {
"end": 1002,
"name": "radius",
"start": 996,
"type": "Identifier"
},
"arg": {
"end": 1017,
"left": {
"end": 1013,
"name": "innerDia",
"start": 1005,
"type": "Identifier",
"type": "Identifier"
},
"operator": "/",
"right": {
"end": 1017,
"raw": "2",
"start": 1016,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 1005,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
}
],
"callee": {
"end": 945,
"name": "circle",
"start": 939,
"type": "Identifier"
},
"end": 1026,
"start": 939,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"end": 1029,
"start": 1028,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 938,
"name": "hole",
"start": 934,
"type": "Identifier"
},
"end": 1030,
"start": 934,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 1052,
"name": "length",
"start": 1046,
"type": "Identifier"
},
"arg": {
"end": 1058,
"name": "thk",
"start": 1055,
"type": "Identifier",
"type": "Identifier"
}
}
],
"callee": {
"end": 1045,
"name": "extrude",
"start": 1038,
"type": "Identifier"
},
"end": 1059,
"start": 1038,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 1059,
"start": 545,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 530,
"type": "VariableDeclarator"
},
"end": 1059,
"kind": "const",
"start": 530,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"argument": {
"end": 1081,
"name": "hexNutSketch",
"start": 1069,
"type": "Identifier",
"type": "Identifier"
},
"end": 1081,
"start": 1062,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 1083,
"start": 526
},
"end": 1083,
"params": [
{
"type": "Parameter",
"identifier": {
"end": 509,
"name": "start",
"start": 504,
"type": "Identifier"
}
},
{
"type": "Parameter",
"identifier": {
"end": 514,
"name": "thk",
"start": 511,
"type": "Identifier"
}
},
{
"type": "Parameter",
"identifier": {
"end": 524,
"name": "innerDia",
"start": 516,
"type": "Identifier"
}
}
],
"start": 503,
"type": "FunctionExpression",
"type": "FunctionExpression"
},
"start": 497,
"type": "VariableDeclarator"
},
"end": 1083,
"kind": "fn",
"start": 494,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 1140,
"expression": {
"arguments": [
{
"elements": [
{
"end": 1114,
"raw": "0",
"start": 1113,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 1117,
"raw": "0",
"start": 1116,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 1118,
"start": 1112,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 1129,
"name": "thickness",
"start": 1120,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 1139,
"name": "diameter",
"start": 1131,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 1111,
"name": "hexNut",
"start": 1105,
"type": "Identifier"
},
"end": 1140,
"start": 1105,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 1105,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 1141,
"innerAttrs": [
{
"end": 350,
"name": {
"end": 326,
"name": "settings",
"start": 318,
"type": "Identifier"
},
"properties": [
{
"end": 349,
"key": {
"end": 344,
"name": "defaultLengthUnit",
"start": 327,
"type": "Identifier"
},
"start": 327,
"type": "ObjectProperty",
"value": {
"end": 349,
"name": "in",
"start": 347,
"type": "Identifier",
"type": "Identifier"
}
}
],
"start": 317,
"type": "Annotation"
}
],
"nonCodeMeta": {
"nonCodeNodes": {
"2": [
{
"end": 493,
"start": 455,
"type": "NonCodeNode",
"value": {
"type": "newLineBlockComment",
"value": "Define a function for the hex nut",
"style": "line"
}
}
],
"3": [
{
"end": 1104,
"start": 1083,
"type": "NonCodeNode",
"value": {
"type": "newLineBlockComment",
"value": "Create a hex nut",
"style": "line"
}
}
]
},
"startNodes": [
{
"end": 10,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
"value": "Hex nut",
"style": "line"
}
},
{
"end": 302,
"start": 11,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
"value": "A hex nut is a type of fastener with a threaded hole and a hexagonal outer shape, used in a wide variety of applications to secure parts together. The hexagonal shape allows for a greater torque to be applied with wrenches or tools, making it one of the most common nut types in hardware.",
"style": "line"
}
},
{
"end": 304,
"start": 302,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
},
{
"end": 316,
"start": 304,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
"value": "Set Units",
"style": "line"
}
},
{
"end": 352,
"start": 350,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
},
{
"end": 396,
"start": 352,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
"value": "Define constants (5/16\" - 24 thread size)",
"style": "line"
}
}
]
},
"start": 0
}
}