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 import_function_not_sketch.kcl
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [
 | 
			
		||||
      0,
 | 
			
		||||
      0,
 | 
			
		||||
      0
 | 
			
		||||
    ],
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "edge_lines_visible",
 | 
			
		||||
      "hidden": false
 | 
			
		||||
@ -17,11 +13,7 @@ description: Artifact commands import_function_not_sketch.kcl
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [
 | 
			
		||||
      0,
 | 
			
		||||
      0,
 | 
			
		||||
      0
 | 
			
		||||
    ],
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "set_scene_units",
 | 
			
		||||
      "unit": "mm"
 | 
			
		||||
@ -29,11 +21,7 @@ description: Artifact commands import_function_not_sketch.kcl
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [
 | 
			
		||||
      0,
 | 
			
		||||
      0,
 | 
			
		||||
      0
 | 
			
		||||
    ],
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "object_visible",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
@ -42,11 +30,7 @@ description: Artifact commands import_function_not_sketch.kcl
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [
 | 
			
		||||
      0,
 | 
			
		||||
      0,
 | 
			
		||||
      0
 | 
			
		||||
    ],
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "object_visible",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
@ -55,11 +39,7 @@ description: Artifact commands import_function_not_sketch.kcl
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [
 | 
			
		||||
      0,
 | 
			
		||||
      33,
 | 
			
		||||
      0
 | 
			
		||||
    ],
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "set_scene_units",
 | 
			
		||||
      "unit": "in"
 | 
			
		||||
 | 
			
		||||
@ -1,12 +1,12 @@
 | 
			
		||||
---
 | 
			
		||||
source: kcl/src/simulation_tests.rs
 | 
			
		||||
source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Result of parsing import_function_not_sketch.kcl
 | 
			
		||||
---
 | 
			
		||||
{
 | 
			
		||||
  "Ok": {
 | 
			
		||||
    "body": [
 | 
			
		||||
      {
 | 
			
		||||
        "end": 68,
 | 
			
		||||
        "end": 0,
 | 
			
		||||
        "path": {
 | 
			
		||||
          "type": "Kcl",
 | 
			
		||||
          "filename": "my_functions.kcl"
 | 
			
		||||
@ -16,29 +16,29 @@ description: Result of parsing import_function_not_sketch.kcl
 | 
			
		||||
          "items": [
 | 
			
		||||
            {
 | 
			
		||||
              "alias": null,
 | 
			
		||||
              "end": 44,
 | 
			
		||||
              "end": 0,
 | 
			
		||||
              "name": {
 | 
			
		||||
                "end": 44,
 | 
			
		||||
                "end": 0,
 | 
			
		||||
                "name": "two",
 | 
			
		||||
                "start": 41,
 | 
			
		||||
                "start": 0,
 | 
			
		||||
                "type": "Identifier"
 | 
			
		||||
              },
 | 
			
		||||
              "start": 41,
 | 
			
		||||
              "start": 0,
 | 
			
		||||
              "type": "ImportItem"
 | 
			
		||||
            }
 | 
			
		||||
          ]
 | 
			
		||||
        },
 | 
			
		||||
        "start": 34,
 | 
			
		||||
        "start": 0,
 | 
			
		||||
        "type": "ImportStatement",
 | 
			
		||||
        "type": "ImportStatement"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "declaration": {
 | 
			
		||||
          "end": 108,
 | 
			
		||||
          "end": 0,
 | 
			
		||||
          "id": {
 | 
			
		||||
            "end": 83,
 | 
			
		||||
            "end": 0,
 | 
			
		||||
            "name": "one",
 | 
			
		||||
            "start": 80,
 | 
			
		||||
            "start": 0,
 | 
			
		||||
            "type": "Identifier"
 | 
			
		||||
          },
 | 
			
		||||
          "init": {
 | 
			
		||||
@ -46,25 +46,25 @@ description: Result of parsing import_function_not_sketch.kcl
 | 
			
		||||
              "body": [
 | 
			
		||||
                {
 | 
			
		||||
                  "argument": {
 | 
			
		||||
                    "end": 106,
 | 
			
		||||
                    "end": 0,
 | 
			
		||||
                    "left": {
 | 
			
		||||
                      "arguments": [],
 | 
			
		||||
                      "callee": {
 | 
			
		||||
                        "end": 100,
 | 
			
		||||
                        "end": 0,
 | 
			
		||||
                        "name": "two",
 | 
			
		||||
                        "start": 97,
 | 
			
		||||
                        "start": 0,
 | 
			
		||||
                        "type": "Identifier"
 | 
			
		||||
                      },
 | 
			
		||||
                      "end": 102,
 | 
			
		||||
                      "start": 97,
 | 
			
		||||
                      "end": 0,
 | 
			
		||||
                      "start": 0,
 | 
			
		||||
                      "type": "CallExpression",
 | 
			
		||||
                      "type": "CallExpression"
 | 
			
		||||
                    },
 | 
			
		||||
                    "operator": "-",
 | 
			
		||||
                    "right": {
 | 
			
		||||
                      "end": 106,
 | 
			
		||||
                      "end": 0,
 | 
			
		||||
                      "raw": "1",
 | 
			
		||||
                      "start": 105,
 | 
			
		||||
                      "start": 0,
 | 
			
		||||
                      "type": "Literal",
 | 
			
		||||
                      "type": "Literal",
 | 
			
		||||
                      "value": {
 | 
			
		||||
@ -72,61 +72,61 @@ description: Result of parsing import_function_not_sketch.kcl
 | 
			
		||||
                        "suffix": "None"
 | 
			
		||||
                      }
 | 
			
		||||
                    },
 | 
			
		||||
                    "start": 97,
 | 
			
		||||
                    "start": 0,
 | 
			
		||||
                    "type": "BinaryExpression",
 | 
			
		||||
                    "type": "BinaryExpression"
 | 
			
		||||
                  },
 | 
			
		||||
                  "end": 106,
 | 
			
		||||
                  "start": 90,
 | 
			
		||||
                  "end": 0,
 | 
			
		||||
                  "start": 0,
 | 
			
		||||
                  "type": "ReturnStatement",
 | 
			
		||||
                  "type": "ReturnStatement"
 | 
			
		||||
                }
 | 
			
		||||
              ],
 | 
			
		||||
              "end": 108,
 | 
			
		||||
              "start": 86
 | 
			
		||||
              "end": 0,
 | 
			
		||||
              "start": 0
 | 
			
		||||
            },
 | 
			
		||||
            "end": 108,
 | 
			
		||||
            "end": 0,
 | 
			
		||||
            "params": [],
 | 
			
		||||
            "start": 83,
 | 
			
		||||
            "start": 0,
 | 
			
		||||
            "type": "FunctionExpression",
 | 
			
		||||
            "type": "FunctionExpression"
 | 
			
		||||
          },
 | 
			
		||||
          "start": 80,
 | 
			
		||||
          "start": 0,
 | 
			
		||||
          "type": "VariableDeclarator"
 | 
			
		||||
        },
 | 
			
		||||
        "end": 108,
 | 
			
		||||
        "end": 0,
 | 
			
		||||
        "kind": "fn",
 | 
			
		||||
        "start": 70,
 | 
			
		||||
        "start": 0,
 | 
			
		||||
        "type": "VariableDeclaration",
 | 
			
		||||
        "type": "VariableDeclaration",
 | 
			
		||||
        "visibility": "export"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "end": 109,
 | 
			
		||||
    "end": 0,
 | 
			
		||||
    "innerAttrs": [
 | 
			
		||||
      {
 | 
			
		||||
        "end": 33,
 | 
			
		||||
        "end": 0,
 | 
			
		||||
        "name": {
 | 
			
		||||
          "end": 9,
 | 
			
		||||
          "end": 0,
 | 
			
		||||
          "name": "settings",
 | 
			
		||||
          "start": 1,
 | 
			
		||||
          "start": 0,
 | 
			
		||||
          "type": "Identifier"
 | 
			
		||||
        },
 | 
			
		||||
        "properties": [
 | 
			
		||||
          {
 | 
			
		||||
            "end": 32,
 | 
			
		||||
            "end": 0,
 | 
			
		||||
            "key": {
 | 
			
		||||
              "end": 27,
 | 
			
		||||
              "end": 0,
 | 
			
		||||
              "name": "defaultLengthUnit",
 | 
			
		||||
              "start": 10,
 | 
			
		||||
              "start": 0,
 | 
			
		||||
              "type": "Identifier"
 | 
			
		||||
            },
 | 
			
		||||
            "start": 10,
 | 
			
		||||
            "start": 0,
 | 
			
		||||
            "type": "ObjectProperty",
 | 
			
		||||
            "value": {
 | 
			
		||||
              "end": 32,
 | 
			
		||||
              "end": 0,
 | 
			
		||||
              "name": "in",
 | 
			
		||||
              "start": 30,
 | 
			
		||||
              "start": 0,
 | 
			
		||||
              "type": "Identifier",
 | 
			
		||||
              "type": "Identifier"
 | 
			
		||||
            }
 | 
			
		||||
@ -140,8 +140,8 @@ description: Result of parsing import_function_not_sketch.kcl
 | 
			
		||||
      "nonCodeNodes": {
 | 
			
		||||
        "0": [
 | 
			
		||||
          {
 | 
			
		||||
            "end": 70,
 | 
			
		||||
            "start": 68,
 | 
			
		||||
            "end": 0,
 | 
			
		||||
            "start": 0,
 | 
			
		||||
            "type": "NonCodeNode",
 | 
			
		||||
            "value": {
 | 
			
		||||
              "type": "newLine"
 | 
			
		||||
 | 
			
		||||
@ -10,19 +10,11 @@ description: Operations executed import_function_not_sketch.kcl
 | 
			
		||||
          "type": "String",
 | 
			
		||||
          "value": "XY"
 | 
			
		||||
        },
 | 
			
		||||
        "sourceRange": [
 | 
			
		||||
          67,
 | 
			
		||||
          71,
 | 
			
		||||
          3
 | 
			
		||||
        ]
 | 
			
		||||
        "sourceRange": []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "name": "startSketchOn",
 | 
			
		||||
    "sourceRange": [
 | 
			
		||||
      53,
 | 
			
		||||
      72,
 | 
			
		||||
      3
 | 
			
		||||
    ],
 | 
			
		||||
    "sourceRange": [],
 | 
			
		||||
    "type": "StdLibCall",
 | 
			
		||||
    "unlabeledArg": null
 | 
			
		||||
  },
 | 
			
		||||
@ -33,19 +25,11 @@ description: Operations executed import_function_not_sketch.kcl
 | 
			
		||||
          "type": "String",
 | 
			
		||||
          "value": "y"
 | 
			
		||||
        },
 | 
			
		||||
        "sourceRange": [
 | 
			
		||||
          320,
 | 
			
		||||
          323,
 | 
			
		||||
          3
 | 
			
		||||
        ]
 | 
			
		||||
        "sourceRange": []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "name": "revolve",
 | 
			
		||||
    "sourceRange": [
 | 
			
		||||
      305,
 | 
			
		||||
      324,
 | 
			
		||||
      3
 | 
			
		||||
    ],
 | 
			
		||||
    "sourceRange": [],
 | 
			
		||||
    "type": "StdLibCall",
 | 
			
		||||
    "unlabeledArg": {
 | 
			
		||||
      "value": {
 | 
			
		||||
@ -54,11 +38,7 @@ description: Operations executed import_function_not_sketch.kcl
 | 
			
		||||
          "artifactId": "[uuid]"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "sourceRange": [
 | 
			
		||||
        305,
 | 
			
		||||
        324,
 | 
			
		||||
        3
 | 
			
		||||
      ]
 | 
			
		||||
      "sourceRange": []
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								rust/kcl-lib/tests/import_function_not_sketch/unparsed.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								rust/kcl-lib/tests/import_function_not_sketch/unparsed.snap
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Result of unparsing import_function_not_sketch.kcl
 | 
			
		||||
---
 | 
			
		||||
@settings(defaultLengthUnit = in)
 | 
			
		||||
import two from "my_functions.kcl"
 | 
			
		||||
 | 
			
		||||
export fn one() {
 | 
			
		||||
  return two() - 1
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,22 @@
 | 
			
		||||
---
 | 
			
		||||
source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Result of unparsing tests/import_function_not_sketch/my_functions.kcl
 | 
			
		||||
---
 | 
			
		||||
@settings(defaultLengthUnit = mm)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export part001 = startSketchOn('XY')
 | 
			
		||||
  |> startProfileAt([4, 12], %)
 | 
			
		||||
  |> line(end = [2, 0])
 | 
			
		||||
  |> line(end = [0, -6])
 | 
			
		||||
  |> line(end = [4, -6])
 | 
			
		||||
  |> line(end = [0, -6])
 | 
			
		||||
  |> line(end = [-3.75, -4.5])
 | 
			
		||||
  |> line(end = [0, -5.5])
 | 
			
		||||
  |> line(end = [-2, 0])
 | 
			
		||||
  |> close()
 | 
			
		||||
  |> revolve(axis = 'y') // default angle is 360
 | 
			
		||||
 | 
			
		||||
export fn two() {
 | 
			
		||||
  return 5
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user