Module/import upgrades (#4677)

* Parse more import syntax

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Remove unnecessary Vec from VariableDeclaration

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Parse export import

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Factor out an execution module

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* imports: constants, globs, export import

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* test fixups

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2024-12-07 07:16:04 +13:00
committed by GitHub
parent 7af62399ac
commit 30d365aeb3
236 changed files with 103332 additions and 103576 deletions

View File

@ -21,7 +21,7 @@ fn assert_out(test_name: &str, result: &image::DynamicImage) {
async fn kcl_test_fillet_duplicate_tags() {
let code = kcl_input!("fillet_duplicate_tags");
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -40,7 +40,7 @@ async fn kcl_test_execute_engine_error_return() {
|> extrude(4, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -53,7 +53,7 @@ async fn kcl_test_execute_i_shape() {
// This is some code from lee that starts a pipe expression with a variable.
let code = kcl_input!("i_shape");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("i_shape", &result);
}
@ -62,7 +62,7 @@ async fn kcl_test_execute_i_shape() {
async fn kcl_test_execute_pipes_on_pipes() {
let code = kcl_input!("pipes_on_pipes");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("pipes_on_pipes", &result);
}
@ -70,7 +70,7 @@ async fn kcl_test_execute_pipes_on_pipes() {
async fn kcl_test_execute_cylinder() {
let code = kcl_input!("cylinder");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("cylinder", &result);
}
@ -78,7 +78,7 @@ async fn kcl_test_execute_cylinder() {
async fn kcl_test_execute_kittycad_svg() {
let code = kcl_input!("kittycad_svg");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("kittycad_svg", &result);
}
@ -86,7 +86,7 @@ async fn kcl_test_execute_kittycad_svg() {
async fn kcl_test_execute_lsystem() {
let code = kcl_input!("lsystem");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("lsystem", &result);
}
@ -94,7 +94,7 @@ async fn kcl_test_execute_lsystem() {
async fn kcl_test_member_expression_sketch() {
let code = kcl_input!("member_expression_sketch");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("member_expression_sketch", &result);
}
@ -102,7 +102,7 @@ async fn kcl_test_member_expression_sketch() {
async fn kcl_test_helix_defaults() {
let code = kcl_input!("helix_defaults");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("helix_defaults", &result);
}
@ -110,7 +110,7 @@ async fn kcl_test_helix_defaults() {
async fn kcl_test_helix_defaults_negative_extrude() {
let code = kcl_input!("helix_defaults_negative_extrude");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("helix_defaults_negative_extrude", &result);
}
@ -118,7 +118,7 @@ async fn kcl_test_helix_defaults_negative_extrude() {
async fn kcl_test_helix_with_length() {
let code = kcl_input!("helix_with_length");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("helix_with_length", &result);
}
@ -126,7 +126,7 @@ async fn kcl_test_helix_with_length() {
async fn kcl_test_dimensions_match() {
let code = kcl_input!("dimensions_match");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("dimensions_match", &result);
}
@ -134,7 +134,7 @@ async fn kcl_test_dimensions_match() {
async fn kcl_test_close_arc() {
let code = kcl_input!("close_arc");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("close_arc", &result);
}
@ -142,7 +142,7 @@ async fn kcl_test_close_arc() {
async fn kcl_test_negative_args() {
let code = kcl_input!("negative_args");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("negative_args", &result);
}
@ -155,7 +155,7 @@ async fn kcl_test_basic_tangential_arc_with_point() {
|> extrude(10, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("tangential_arc_with_point", &result);
}
@ -168,7 +168,7 @@ async fn kcl_test_basic_tangential_arc_to() {
|> extrude(10, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("tangential_arc_to", &result);
}
@ -195,7 +195,7 @@ box(30, 43, 18, '-xy')
let thing = box(-12, -15, 10, 'yz')
box(-20, -5, 10, 'xy')"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("different_planes_same_drawing", &result);
}
@ -253,7 +253,7 @@ part004 = startSketchOn('YZ')
|> close(%)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("lots_of_planes", &result);
}
@ -270,7 +270,7 @@ async fn kcl_test_holes() {
|> extrude(2, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("holes", &result);
}
@ -289,7 +289,7 @@ async fn optional_params() {
thing = other_circle([2, 2], 20)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("optional_params", &result);
}
@ -325,7 +325,7 @@ part = roundedRectangle([0, 0], 20, 20, 4)
|> extrude(2, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("rounded_with_holes", &result);
}
@ -333,7 +333,7 @@ part = roundedRectangle([0, 0], 20, 20, 4)
async fn kcl_test_top_level_expression() {
let code = r#"startSketchOn('XY') |> circle({ center: [0,0], radius: 22 }, %) |> extrude(14, %)"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("top_level_expression", &result);
}
@ -347,7 +347,7 @@ part = startSketchOn('XY')
|> extrude(1, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("patterns_linear_basic_with_math", &result);
}
@ -359,7 +359,7 @@ async fn kcl_test_patterns_linear_basic() {
|> extrude(1, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("patterns_linear_basic", &result);
}
@ -375,7 +375,7 @@ async fn kcl_test_patterns_linear_basic_3d() {
|> patternLinear3d({axis: [1, 0, 1], instances: 4, distance: 6}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("patterns_linear_basic_3d", &result);
}
@ -387,7 +387,7 @@ async fn kcl_test_patterns_linear_basic_negative_distance() {
|> extrude(1, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("patterns_linear_basic_negative_distance", &result);
}
@ -399,7 +399,7 @@ async fn kcl_test_patterns_linear_basic_negative_axis() {
|> extrude(1, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("patterns_linear_basic_negative_axis", &result);
}
@ -420,7 +420,7 @@ rectangle = startSketchOn('XY')
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("patterns_linear_basic_holes", &result);
}
@ -432,7 +432,7 @@ async fn kcl_test_patterns_circular_basic_2d() {
|> extrude(1, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("patterns_circular_basic_2d", &result);
}
@ -448,7 +448,7 @@ async fn kcl_test_patterns_circular_basic_3d() {
|> patternCircular3d({axis: [0,0, 1], center: [-20, -20, -20], instances: 41, arcDegrees: 360, rotateDuplicates: false}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("patterns_circular_basic_3d", &result);
}
@ -464,7 +464,7 @@ async fn kcl_test_patterns_circular_3d_tilted_axis() {
|> patternCircular3d({axis: [1,1,0], center: [10, 0, 10], instances: 11, arcDegrees: 360, rotateDuplicates: true}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("patterns_circular_3d_tilted_axis", &result);
}
@ -472,7 +472,7 @@ async fn kcl_test_patterns_circular_3d_tilted_axis() {
async fn kcl_test_import_file_doesnt_exist() {
let code = r#"model = import("thing.obj")"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -484,7 +484,7 @@ async fn kcl_test_import_file_doesnt_exist() {
async fn kcl_test_import_obj_with_mtl() {
let code = r#"model = import("tests/executor/inputs/cube.obj")"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("import_obj_with_mtl", &result);
}
@ -492,7 +492,7 @@ async fn kcl_test_import_obj_with_mtl() {
async fn kcl_test_import_obj_with_mtl_units() {
let code = r#"model = import("tests/executor/inputs/cube.obj", {format: "obj", units: "m"})"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("import_obj_with_mtl_units", &result);
}
@ -500,7 +500,7 @@ async fn kcl_test_import_obj_with_mtl_units() {
async fn kcl_test_import_stl() {
let code = r#"model = import("tests/executor/inputs/2-5-long-m8-chc-screw.stl")"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("import_stl", &result);
}
@ -508,7 +508,7 @@ async fn kcl_test_import_stl() {
async fn kcl_test_import_gltf_with_bin() {
let code = r#"model = import("tests/executor/inputs/cube.gltf")"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("import_gltf_with_bin", &result);
}
@ -516,7 +516,7 @@ async fn kcl_test_import_gltf_with_bin() {
async fn kcl_test_import_gltf_embedded() {
let code = r#"model = import("tests/executor/inputs/cube-embedded.gltf")"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("import_gltf_embedded", &result);
}
@ -524,7 +524,7 @@ async fn kcl_test_import_gltf_embedded() {
async fn kcl_test_import_glb() {
let code = r#"model = import("tests/executor/inputs/cube.glb")"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("import_glb", &result);
}
@ -532,7 +532,7 @@ async fn kcl_test_import_glb() {
async fn kcl_test_import_glb_no_assign() {
let code = r#"import("tests/executor/inputs/cube.glb")"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("import_glb_no_assign", &result);
}
@ -540,7 +540,7 @@ async fn kcl_test_import_glb_no_assign() {
async fn kcl_test_import_ext_doesnt_match() {
let code = r#"model = import("tests/executor/inputs/cube.gltf", {format: "obj", units: "m"})"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -565,7 +565,7 @@ async fn kcl_test_cube_mm() {
myCube = cube([0,0], 10)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("cube_mm", &result);
}
@ -586,7 +586,7 @@ async fn kcl_test_cube_cm() {
myCube = cube([0,0], 10)
"#;
let result = execute_and_snapshot(code, UnitLength::Cm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Cm, None).await.unwrap();
assert_out("cube_cm", &result);
}
@ -607,7 +607,7 @@ async fn kcl_test_cube_m() {
myCube = cube([0,0], 10)
"#;
let result = execute_and_snapshot(code, UnitLength::M).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::M, None).await.unwrap();
assert_out("cube_m", &result);
}
@ -628,7 +628,7 @@ async fn kcl_test_cube_in() {
myCube = cube([0,0], 10)
"#;
let result = execute_and_snapshot(code, UnitLength::In).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::In, None).await.unwrap();
assert_out("cube_in", &result);
}
@ -649,7 +649,7 @@ async fn kcl_test_cube_ft() {
myCube = cube([0,0], 10)
"#;
let result = execute_and_snapshot(code, UnitLength::Ft).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Ft, None).await.unwrap();
assert_out("cube_ft", &result);
}
@ -670,7 +670,7 @@ async fn kcl_test_cube_yd() {
myCube = cube([0,0], 10)
"#;
let result = execute_and_snapshot(code, UnitLength::Yd).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Yd, None).await.unwrap();
assert_out("cube_yd", &result);
}
@ -698,7 +698,7 @@ part002 = startSketchOn(part001, part001.sketch.tags.here)
|> extrude(1, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
@ -739,7 +739,7 @@ part003 = startSketchOn(part002, "end")
|> extrude(5, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("sketch_on_face_of_face", &result);
}
@ -756,7 +756,7 @@ async fn kcl_test_stdlib_kcl_error_right_code_path() {
|> extrude(2, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -784,7 +784,7 @@ part002 = startSketchOn(part001, "end")
|> extrude(5, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("sketch_on_face_circle", &result);
}
@ -826,7 +826,7 @@ part = rectShape([0, 0], 20, 20)
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -850,7 +850,7 @@ async fn kcl_test_simple_revolve() {
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("simple_revolve", &result);
}
@ -870,7 +870,7 @@ async fn kcl_test_simple_revolve_uppercase() {
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("simple_revolve_uppercase", &result);
}
@ -890,7 +890,7 @@ async fn kcl_test_simple_revolve_negative() {
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("simple_revolve_negative", &result);
}
@ -910,7 +910,7 @@ async fn kcl_test_revolve_bad_angle_low() {
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
@ -935,7 +935,7 @@ async fn kcl_test_revolve_bad_angle_high() {
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
@ -960,7 +960,7 @@ async fn kcl_test_simple_revolve_custom_angle() {
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("simple_revolve_custom_angle", &result);
}
@ -980,7 +980,7 @@ async fn kcl_test_simple_revolve_custom_axis() {
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("simple_revolve_custom_axis", &result);
}
@ -1004,7 +1004,7 @@ sketch001 = startSketchOn(box, "end")
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("revolve_on_edge", &result);
}
@ -1028,7 +1028,7 @@ sketch001 = startSketchOn(box, revolveAxis)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
//this fails right now, but slightly differently, lets just say its enough for it to fail - mike
@ -1056,7 +1056,7 @@ sketch001 = startSketchOn(box, "END")
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("revolve_on_face_circle_edge", &result);
}
@ -1078,7 +1078,7 @@ sketch001 = startSketchOn(box, "END")
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("revolve_on_face_circle", &result);
}
@ -1104,7 +1104,7 @@ sketch001 = startSketchOn(box, "end")
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("revolve_on_face", &result);
}
@ -1118,7 +1118,7 @@ async fn kcl_test_basic_revolve_circle() {
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("basic_revolve_circle", &result);
}
@ -1145,7 +1145,7 @@ part002 = startSketchOn(part001, 'end')
|> extrude(5, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("simple_revolve_sketch_on_edge", &result);
}
@ -1208,7 +1208,7 @@ plumbus1 = circle1
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("plumbus_fillets", &result);
}
@ -1216,7 +1216,7 @@ plumbus1 = circle1
async fn kcl_test_empty_file_is_ok() {
let code = r#""#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_ok());
}
@ -1246,7 +1246,7 @@ async fn kcl_test_member_expression_in_params() {
capScrew([0, 0.5, 0], 50, 37.5, 50, 25)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("member_expression_in_params", &result);
}
@ -1291,7 +1291,7 @@ bracket = startSketchOn('XY')
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_ok());
}
@ -1311,7 +1311,7 @@ secondSketch = startSketchOn(part001, '')
|> extrude(20, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1342,7 +1342,7 @@ extrusion = startSketchOn('XY')
|> extrude(height, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1375,7 +1375,7 @@ sketch001 = [profile001, profile002]
extrude(10, sketch001)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("array_of_sketches", &result);
}
@ -1411,7 +1411,7 @@ pattn1 = patternLinear3d({
}, extrudes)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("pattern3d_array_of_extrudes", &result);
}
@ -1459,7 +1459,7 @@ baseExtrusion = extrude(width, sketch001)
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("fillets_referencing_other_fillets", &result);
}
@ -1507,7 +1507,7 @@ baseExtrusion = extrude(width, sketch001)
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("chamfers_referencing_other_chamfers", &result);
}
@ -1527,7 +1527,7 @@ async fn kcl_test_shell_with_tag() {
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("shell_with_tag", &result);
}
@ -1558,7 +1558,7 @@ pattn1 = patternLinear3d({
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("linear_pattern3d_filleted_sketch", &result);
}
@ -1585,7 +1585,7 @@ pattn2 = patternCircular3d({axis: [0,0, 1], center: [-20, -20, -20], instances:
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("circular_pattern3d_filleted_sketch", &result);
}
@ -1612,7 +1612,7 @@ pattn2 = patternCircular3d({axis: [0,0, 1], center: [-20, -20, -20], instances:
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("circular_pattern3d_chamfered_sketch", &result);
}
@ -1638,7 +1638,7 @@ part001 = cube([0,0], 20)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1665,7 +1665,7 @@ async fn kcl_test_duplicate_tags_should_error() {
let p = triangle(200)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1676,49 +1676,49 @@ let p = triangle(200)
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_global_tags() {
let code = kcl_input!("global-tags");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("global_tags", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_extrude_inside_fn_with_tags() {
let code = kcl_input!("extrude-inside-fn-with-tags");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("extrude-inside-fn-with-tags", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_pattern_vase() {
let code = kcl_input!("pattern_vase");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("pattern_vase", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_scoped_tags() {
let code = kcl_input!("scoped-tags");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("scoped_tags", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_order_sketch_extrude_in_order() {
let code = kcl_input!("order-sketch-extrude-in-order");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("order-sketch-extrude-in-order", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_order_sketch_extrude_out_of_order() {
let code = kcl_input!("order-sketch-extrude-out-of-order");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("order-sketch-extrude-out-of-order", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_extrude_custom_plane() {
let code = kcl_input!("extrude-custom-plane");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("extrude-custom-plane", &result);
}
@ -1740,7 +1740,7 @@ async fn kcl_test_arc_error_same_start_end() {
}, %)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1760,7 +1760,7 @@ async fn kcl_test_angled_line_to_x_90() {
example = extrude(10, exampleSketch)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1780,7 +1780,7 @@ async fn kcl_test_angled_line_to_x_270() {
example = extrude(10, exampleSketch)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1800,7 +1800,7 @@ async fn kcl_test_angled_line_to_y_0() {
example = extrude(10, exampleSketch)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1820,7 +1820,7 @@ async fn kcl_test_angled_line_to_y_180() {
example = extrude(10, exampleSketch)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1840,7 +1840,7 @@ async fn kcl_test_angled_line_of_x_length_90() {
extrusion = extrude(10, sketch001)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1860,7 +1860,7 @@ async fn kcl_test_angled_line_of_x_length_270() {
extrusion = extrude(10, sketch001)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1882,7 +1882,7 @@ async fn kcl_test_angled_line_of_y_length_0() {
example = extrude(10, exampleSketch)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1904,7 +1904,7 @@ async fn kcl_test_angled_line_of_y_length_180() {
example = extrude(10, exampleSketch)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1926,7 +1926,7 @@ async fn kcl_test_angled_line_of_y_length_negative_180() {
example = extrude(10, exampleSketch)
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1943,7 +1943,7 @@ async fn kcl_test_error_inside_fn_also_has_source_range_of_call_site() {
someFunction('INVALID')
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1964,7 +1964,7 @@ async fn kcl_test_error_inside_fn_also_has_source_range_of_call_site_recursive()
someFunction('INVALID')
"#;
let result = execute_and_snapshot(code, UnitLength::Mm).await;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
@ -1988,7 +1988,7 @@ async fn kcl_test_error_no_auth_websocket() {
}, %)
"#;
let result = execute_and_snapshot_no_auth(code, UnitLength::Mm).await;
let result = execute_and_snapshot_no_auth(code, UnitLength::Mm, None).await;
assert!(result.is_err());
assert!(result
.err()