properly flush batch (#5565)
* properly flush batch Signed-off-by: Jess Frazelle <github@jessfraz.com> * add test Signed-off-by: Jess Frazelle <github@jessfraz.com> * add test Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * only flush if not on error Signed-off-by: Jess Frazelle <github@jessfraz.com> * better method Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * ensure nothing in batch assembly test Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -123,7 +123,11 @@ impl ExecutorContext {
|
||||
};
|
||||
std::mem::swap(&mut exec_state.mod_local, &mut local_state);
|
||||
|
||||
if !exec_kind.is_isolated() && new_units != old_units {
|
||||
// We only need to reset the units if we are not on the Main path.
|
||||
// If we reset at the end of the main path, then we just add on an extra
|
||||
// command and we'd need to flush the batch again.
|
||||
// This avoids that.
|
||||
if !exec_kind.is_isolated() && new_units != old_units && *path != ModulePath::Main {
|
||||
self.engine.set_units(old_units.into(), Default::default()).await?;
|
||||
}
|
||||
self.engine.replace_execution_kind(original_execution).await;
|
||||
|
||||
@ -2074,3 +2074,25 @@ mod import_file_parse_error {
|
||||
super::execute(TEST_NAME, true).await
|
||||
}
|
||||
}
|
||||
|
||||
mod flush_batch_on_end {
|
||||
const TEST_NAME: &str = "flush_batch_on_end";
|
||||
|
||||
/// Test parsing KCL.
|
||||
#[test]
|
||||
fn parse() {
|
||||
super::parse(TEST_NAME);
|
||||
}
|
||||
|
||||
/// Test that parsing and unparsing KCL produces the original KCL input.
|
||||
#[test]
|
||||
fn unparse() {
|
||||
super::unparse(TEST_NAME)
|
||||
}
|
||||
|
||||
/// Test that KCL is executed correctly.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn kcl_test_execute() {
|
||||
super::execute(TEST_NAME, true).await
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Artifact commands cube_with_error.kcl
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
||||
655
src/wasm-lib/kcl/tests/flush_batch_on_end/artifact_commands.snap
Normal file
655
src/wasm-lib/kcl/tests/flush_batch_on_end/artifact_commands.snap
Normal file
@ -0,0 +1,655 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Artifact commands flush_batch_on_end.kcl
|
||||
---
|
||||
[
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "plane_set_color",
|
||||
"plane_id": "[uuid]",
|
||||
"color": {
|
||||
"r": 0.7,
|
||||
"g": 0.28,
|
||||
"b": 0.28,
|
||||
"a": 0.4
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "plane_set_color",
|
||||
"plane_id": "[uuid]",
|
||||
"color": {
|
||||
"r": 0.28,
|
||||
"g": 0.7,
|
||||
"b": 0.28,
|
||||
"a": 0.4
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "plane_set_color",
|
||||
"plane_id": "[uuid]",
|
||||
"color": {
|
||||
"r": 0.28,
|
||||
"g": 0.28,
|
||||
"b": 0.7,
|
||||
"a": 0.4
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": -1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": 0.0,
|
||||
"y": -1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": -1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "edge_lines_visible",
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "set_scene_units",
|
||||
"unit": "mm"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
"hidden": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
"hidden": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
33,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "set_scene_units",
|
||||
"unit": "in"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
199,
|
||||
218,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"size": 60.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "enable_sketch_mode",
|
||||
"entity_id": "[uuid]",
|
||||
"ortho": false,
|
||||
"animated": false,
|
||||
"adjust_camera": false,
|
||||
"planar_normal": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "start_path"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "move_path_pen",
|
||||
"path": "[uuid]",
|
||||
"to": {
|
||||
"x": 0.2734375,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "extend_path",
|
||||
"path": "[uuid]",
|
||||
"segment": {
|
||||
"type": "arc",
|
||||
"center": {
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
},
|
||||
"radius": 0.2734375,
|
||||
"start": {
|
||||
"unit": "degrees",
|
||||
"value": 0.0
|
||||
},
|
||||
"end": {
|
||||
"unit": "degrees",
|
||||
"value": 360.0
|
||||
},
|
||||
"relative": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "close_path",
|
||||
"path_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
428,
|
||||
511,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "enable_sketch_mode",
|
||||
"entity_id": "[uuid]",
|
||||
"ortho": false,
|
||||
"animated": false,
|
||||
"adjust_camera": false,
|
||||
"planar_normal": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
428,
|
||||
511,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "start_path"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
428,
|
||||
511,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "move_path_pen",
|
||||
"path": "[uuid]",
|
||||
"to": {
|
||||
"x": 0.182,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
428,
|
||||
511,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "extend_path",
|
||||
"path": "[uuid]",
|
||||
"segment": {
|
||||
"type": "arc",
|
||||
"center": {
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
},
|
||||
"radius": 0.182,
|
||||
"start": {
|
||||
"unit": "degrees",
|
||||
"value": 0.0
|
||||
},
|
||||
"end": {
|
||||
"unit": "degrees",
|
||||
"value": 360.0
|
||||
},
|
||||
"relative": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
428,
|
||||
511,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "close_path",
|
||||
"path_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
601,
|
||||
622,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "solid2d_add_hole",
|
||||
"object_id": "[uuid]",
|
||||
"hole_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
601,
|
||||
622,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
"hidden": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
678,
|
||||
715,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "enable_sketch_mode",
|
||||
"entity_id": "[uuid]",
|
||||
"ortho": false,
|
||||
"animated": false,
|
||||
"adjust_camera": false,
|
||||
"planar_normal": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
678,
|
||||
715,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "extrude",
|
||||
"target": "[uuid]",
|
||||
"distance": 1.5,
|
||||
"faces": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
678,
|
||||
715,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "sketch_mode_disable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
678,
|
||||
715,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "object_bring_to_front",
|
||||
"object_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
678,
|
||||
715,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "solid3d_get_extrusion_face_info",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
678,
|
||||
715,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "solid3d_get_opposite_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
678,
|
||||
715,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "solid3d_get_next_adjacent_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
678,
|
||||
715,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "solid3d_get_opposite_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
678,
|
||||
715,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "solid3d_get_next_adjacent_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -0,0 +1,6 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Artifact graph flowchart flush_batch_on_end.kcl
|
||||
extension: md
|
||||
snapshot_kind: binary
|
||||
---
|
||||
@ -0,0 +1,35 @@
|
||||
```mermaid
|
||||
flowchart LR
|
||||
subgraph path2 [Path]
|
||||
2["Path<br>[282, 365, 0]"]
|
||||
3["Segment<br>[282, 365, 0]"]
|
||||
4[Solid2d]
|
||||
end
|
||||
subgraph path5 [Path]
|
||||
5["Path<br>[428, 511, 0]"]
|
||||
6["Segment<br>[428, 511, 0]"]
|
||||
7[Solid2d]
|
||||
end
|
||||
1["Plane<br>[199, 218, 0]"]
|
||||
8["Sweep Extrusion<br>[678, 715, 0]"]
|
||||
9[Wall]
|
||||
10["Cap Start"]
|
||||
11["Cap End"]
|
||||
12["SweepEdge Opposite"]
|
||||
13["SweepEdge Adjacent"]
|
||||
1 --- 2
|
||||
1 --- 5
|
||||
2 --- 3
|
||||
2 ---- 8
|
||||
2 --- 4
|
||||
3 --- 9
|
||||
3 --- 12
|
||||
3 --- 13
|
||||
5 --- 6
|
||||
5 --- 7
|
||||
8 --- 9
|
||||
8 --- 10
|
||||
8 --- 11
|
||||
8 --- 12
|
||||
8 --- 13
|
||||
```
|
||||
700
src/wasm-lib/kcl/tests/flush_batch_on_end/ast.snap
Normal file
700
src/wasm-lib/kcl/tests/flush_batch_on_end/ast.snap
Normal file
@ -0,0 +1,700 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Result of parsing flush_batch_on_end.kcl
|
||||
---
|
||||
{
|
||||
"Ok": {
|
||||
"body": [
|
||||
{
|
||||
"declaration": {
|
||||
"end": 105,
|
||||
"id": {
|
||||
"end": 97,
|
||||
"name": "innerDiameter",
|
||||
"start": 84,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"end": 105,
|
||||
"raw": "0.364",
|
||||
"start": 100,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.364,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 84,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 105,
|
||||
"kind": "const",
|
||||
"start": 84,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 129,
|
||||
"id": {
|
||||
"end": 119,
|
||||
"name": "outerDiameter",
|
||||
"start": 106,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"end": 129,
|
||||
"left": {
|
||||
"end": 124,
|
||||
"raw": "35",
|
||||
"start": 122,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 35.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": "/",
|
||||
"right": {
|
||||
"end": 129,
|
||||
"raw": "64",
|
||||
"start": 127,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 64.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 122,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"start": 106,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 129,
|
||||
"kind": "const",
|
||||
"start": 106,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 148,
|
||||
"id": {
|
||||
"end": 136,
|
||||
"name": "length",
|
||||
"start": 130,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"end": 148,
|
||||
"left": {
|
||||
"end": 140,
|
||||
"raw": "1",
|
||||
"start": 139,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 148,
|
||||
"left": {
|
||||
"end": 144,
|
||||
"raw": "1",
|
||||
"start": 143,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"operator": "/",
|
||||
"right": {
|
||||
"end": 148,
|
||||
"raw": "2",
|
||||
"start": 147,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 143,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"start": 139,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"start": 130,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 148,
|
||||
"kind": "const",
|
||||
"start": 130,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 218,
|
||||
"id": {
|
||||
"end": 196,
|
||||
"name": "sketch000",
|
||||
"start": 187,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 217,
|
||||
"raw": "'XY'",
|
||||
"start": 213,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "XY"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 212,
|
||||
"name": "startSketchOn",
|
||||
"start": 199,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 218,
|
||||
"start": 199,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 187,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 218,
|
||||
"kind": "const",
|
||||
"start": 187,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 365,
|
||||
"id": {
|
||||
"end": 279,
|
||||
"name": "outerProfile",
|
||||
"start": 267,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 344,
|
||||
"properties": [
|
||||
{
|
||||
"end": 312,
|
||||
"key": {
|
||||
"end": 299,
|
||||
"name": "center",
|
||||
"start": 293,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 293,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 306,
|
||||
"raw": "0.0",
|
||||
"start": 303,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 311,
|
||||
"raw": "0.0",
|
||||
"start": 308,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 312,
|
||||
"start": 302,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 342,
|
||||
"key": {
|
||||
"end": 322,
|
||||
"name": "radius",
|
||||
"start": 316,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 316,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"end": 342,
|
||||
"left": {
|
||||
"end": 338,
|
||||
"name": "outerDiameter",
|
||||
"start": 325,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "/",
|
||||
"right": {
|
||||
"end": 342,
|
||||
"raw": "2",
|
||||
"start": 341,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 325,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 289,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
},
|
||||
{
|
||||
"end": 355,
|
||||
"name": "sketch000",
|
||||
"start": 346,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
{
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 288,
|
||||
"name": "circle",
|
||||
"start": 282,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 365,
|
||||
"start": 282,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 267,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 365,
|
||||
"kind": "const",
|
||||
"start": 267,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 511,
|
||||
"id": {
|
||||
"end": 425,
|
||||
"name": "innerProfile",
|
||||
"start": 413,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 490,
|
||||
"properties": [
|
||||
{
|
||||
"end": 458,
|
||||
"key": {
|
||||
"end": 445,
|
||||
"name": "center",
|
||||
"start": 439,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 439,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 452,
|
||||
"raw": "0.0",
|
||||
"start": 449,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 457,
|
||||
"raw": "0.0",
|
||||
"start": 454,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 458,
|
||||
"start": 448,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 488,
|
||||
"key": {
|
||||
"end": 468,
|
||||
"name": "radius",
|
||||
"start": 462,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 462,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"end": 488,
|
||||
"left": {
|
||||
"end": 484,
|
||||
"name": "innerDiameter",
|
||||
"start": 471,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "/",
|
||||
"right": {
|
||||
"end": 488,
|
||||
"raw": "2",
|
||||
"start": 487,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 471,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 435,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
},
|
||||
{
|
||||
"end": 501,
|
||||
"name": "sketch000",
|
||||
"start": 492,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
{
|
||||
"end": 510,
|
||||
"start": 503,
|
||||
"type": "TagDeclarator",
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc001"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 434,
|
||||
"name": "circle",
|
||||
"start": 428,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 511,
|
||||
"start": 428,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 413,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 511,
|
||||
"kind": "const",
|
||||
"start": 413,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 670,
|
||||
"id": {
|
||||
"end": 580,
|
||||
"name": "pipeProfile",
|
||||
"start": 569,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"body": [
|
||||
{
|
||||
"end": 595,
|
||||
"name": "outerProfile",
|
||||
"start": 583,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 618,
|
||||
"name": "innerProfile",
|
||||
"start": 606,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
{
|
||||
"end": 621,
|
||||
"start": 620,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 605,
|
||||
"name": "hole",
|
||||
"start": 601,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 622,
|
||||
"start": 601,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
}
|
||||
],
|
||||
"end": 670,
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"1": [
|
||||
{
|
||||
"end": 670,
|
||||
"start": 622,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLineBlockComment",
|
||||
"value": "extrude the pipe profile to create the pipe",
|
||||
"style": "line"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"startNodes": []
|
||||
},
|
||||
"start": 583,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 569,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 670,
|
||||
"kind": "const",
|
||||
"start": 569,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 715,
|
||||
"id": {
|
||||
"end": 675,
|
||||
"name": "pipe",
|
||||
"start": 671,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"name": "length"
|
||||
},
|
||||
"arg": {
|
||||
"end": 714,
|
||||
"name": "length",
|
||||
"start": 708,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 685,
|
||||
"name": "extrude",
|
||||
"start": 678,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 715,
|
||||
"start": 678,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": {
|
||||
"end": 697,
|
||||
"name": "pipeProfile",
|
||||
"start": 686,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
},
|
||||
"start": 671,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 715,
|
||||
"kind": "const",
|
||||
"start": 671,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 716,
|
||||
"innerAttrs": [
|
||||
{
|
||||
"end": 33,
|
||||
"name": {
|
||||
"end": 9,
|
||||
"name": "settings",
|
||||
"start": 1,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"end": 32,
|
||||
"key": {
|
||||
"end": 27,
|
||||
"name": "defaultLengthUnit",
|
||||
"start": 10,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 10,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"end": 32,
|
||||
"name": "in",
|
||||
"start": 30,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 0,
|
||||
"type": "Annotation"
|
||||
}
|
||||
],
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"2": [
|
||||
{
|
||||
"end": 186,
|
||||
"start": 148,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLineBlockComment",
|
||||
"value": "create a sketch on the 'XY' plane",
|
||||
"style": "line"
|
||||
}
|
||||
}
|
||||
],
|
||||
"3": [
|
||||
{
|
||||
"end": 266,
|
||||
"start": 218,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLineBlockComment",
|
||||
"value": "create a profile of the outside of the pipe",
|
||||
"style": "line"
|
||||
}
|
||||
}
|
||||
],
|
||||
"4": [
|
||||
{
|
||||
"end": 412,
|
||||
"start": 365,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLineBlockComment",
|
||||
"value": "create a profile of the inside of the pipe",
|
||||
"style": "line"
|
||||
}
|
||||
}
|
||||
],
|
||||
"5": [
|
||||
{
|
||||
"end": 568,
|
||||
"start": 511,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLineBlockComment",
|
||||
"value": "create a profile with holes sketch000Profile000Holes",
|
||||
"style": "line"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"startNodes": [
|
||||
{
|
||||
"end": 61,
|
||||
"start": 34,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "Set units in inches (in)",
|
||||
"style": "line"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 64,
|
||||
"start": 61,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLine"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 83,
|
||||
"start": 64,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "Define constants",
|
||||
"style": "line"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"start": 0
|
||||
}
|
||||
}
|
||||
30
src/wasm-lib/kcl/tests/flush_batch_on_end/input.kcl
Normal file
30
src/wasm-lib/kcl/tests/flush_batch_on_end/input.kcl
Normal file
@ -0,0 +1,30 @@
|
||||
@settings(defaultLengthUnit = in)
|
||||
// Set units in inches (in)
|
||||
|
||||
|
||||
// Define constants
|
||||
innerDiameter = 0.364
|
||||
outerDiameter = 35 / 64
|
||||
length = 1 + 1 / 2
|
||||
|
||||
// create a sketch on the 'XY' plane
|
||||
sketch000 = startSketchOn('XY')
|
||||
|
||||
// create a profile of the outside of the pipe
|
||||
outerProfile = circle({
|
||||
center = [0.0, 0.0],
|
||||
radius = outerDiameter / 2
|
||||
}, sketch000, $arc000)
|
||||
|
||||
// create a profile of the inside of the pipe
|
||||
innerProfile = circle({
|
||||
center = [0.0, 0.0],
|
||||
radius = innerDiameter / 2
|
||||
}, sketch000, $arc001)
|
||||
|
||||
// create a profile with holes sketch000Profile000Holes
|
||||
pipeProfile = outerProfile
|
||||
|> hole(innerProfile, %)
|
||||
|
||||
// extrude the pipe profile to create the pipe
|
||||
pipe = extrude(pipeProfile, length = length)
|
||||
105
src/wasm-lib/kcl/tests/flush_batch_on_end/ops.snap
Normal file
105
src/wasm-lib/kcl/tests/flush_batch_on_end/ops.snap
Normal file
@ -0,0 +1,105 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Operations executed flush_batch_on_end.kcl
|
||||
---
|
||||
[
|
||||
{
|
||||
"labeledArgs": {
|
||||
"data": {
|
||||
"value": {
|
||||
"type": "String",
|
||||
"value": "XY"
|
||||
},
|
||||
"sourceRange": [
|
||||
213,
|
||||
217,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "startSketchOn",
|
||||
"sourceRange": [
|
||||
199,
|
||||
218,
|
||||
0
|
||||
],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": null
|
||||
},
|
||||
{
|
||||
"labeledArgs": {
|
||||
"holeSketch": {
|
||||
"value": {
|
||||
"type": "Sketch",
|
||||
"value": {
|
||||
"artifactId": "[uuid]"
|
||||
}
|
||||
},
|
||||
"sourceRange": [
|
||||
606,
|
||||
618,
|
||||
0
|
||||
]
|
||||
},
|
||||
"sketch": {
|
||||
"value": {
|
||||
"type": "Sketch",
|
||||
"value": {
|
||||
"artifactId": "[uuid]"
|
||||
}
|
||||
},
|
||||
"sourceRange": [
|
||||
620,
|
||||
621,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "hole",
|
||||
"sourceRange": [
|
||||
601,
|
||||
622,
|
||||
0
|
||||
],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": null
|
||||
},
|
||||
{
|
||||
"labeledArgs": {
|
||||
"length": {
|
||||
"value": {
|
||||
"type": "Number",
|
||||
"value": 1.5,
|
||||
"ty": {
|
||||
"type": "Unknown"
|
||||
}
|
||||
},
|
||||
"sourceRange": [
|
||||
708,
|
||||
714,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "extrude",
|
||||
"sourceRange": [
|
||||
678,
|
||||
715,
|
||||
0
|
||||
],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": {
|
||||
"value": {
|
||||
"type": "Sketch",
|
||||
"value": {
|
||||
"artifactId": "[uuid]"
|
||||
}
|
||||
},
|
||||
"sourceRange": [
|
||||
686,
|
||||
697,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
975
src/wasm-lib/kcl/tests/flush_batch_on_end/program_memory.snap
Normal file
975
src/wasm-lib/kcl/tests/flush_batch_on_end/program_memory.snap
Normal file
@ -0,0 +1,975 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Variables in memory after executing flush_batch_on_end.kcl
|
||||
---
|
||||
{
|
||||
"arc000": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "arc000",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"radius": 0.2734375,
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"to": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"type": "Circle",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
}
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"type": "extrudeArc"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
357,
|
||||
364,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"arc001": {
|
||||
"type": "TagIdentifier",
|
||||
"type": "TagIdentifier",
|
||||
"value": "arc001",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
428,
|
||||
511,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from": [
|
||||
0.182,
|
||||
0.0
|
||||
],
|
||||
"radius": 0.182,
|
||||
"tag": {
|
||||
"end": 510,
|
||||
"start": 503,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc001"
|
||||
},
|
||||
"to": [
|
||||
0.182,
|
||||
0.0
|
||||
],
|
||||
"type": "Circle",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
}
|
||||
},
|
||||
"surface": null
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
503,
|
||||
510,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"innerDiameter": {
|
||||
"type": "Number",
|
||||
"value": 0.364,
|
||||
"ty": {
|
||||
"type": "Default",
|
||||
"len": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"angle": {
|
||||
"type": "Degrees"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
100,
|
||||
105,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"innerProfile": {
|
||||
"type": "Sketch",
|
||||
"value": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
428,
|
||||
511,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from": [
|
||||
0.182,
|
||||
0.0
|
||||
],
|
||||
"radius": 0.182,
|
||||
"tag": {
|
||||
"end": 510,
|
||||
"start": 503,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc001"
|
||||
},
|
||||
"to": [
|
||||
0.182,
|
||||
0.0
|
||||
],
|
||||
"type": "Circle",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
}
|
||||
}
|
||||
],
|
||||
"on": {
|
||||
"type": "plane",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "XY",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"xAxis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"yAxis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"zAxis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
0.182,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.182,
|
||||
0.0
|
||||
],
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
428,
|
||||
511,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"arc001": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "arc001",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
428,
|
||||
511,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from": [
|
||||
0.182,
|
||||
0.0
|
||||
],
|
||||
"radius": 0.182,
|
||||
"tag": {
|
||||
"end": 510,
|
||||
"start": 503,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc001"
|
||||
},
|
||||
"to": [
|
||||
0.182,
|
||||
0.0
|
||||
],
|
||||
"type": "Circle",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
}
|
||||
},
|
||||
"surface": null
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
503,
|
||||
510,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
428,
|
||||
511,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"length": {
|
||||
"type": "Number",
|
||||
"value": 1.5,
|
||||
"ty": {
|
||||
"type": "Unknown"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
139,
|
||||
140,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
143,
|
||||
144,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
147,
|
||||
148,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"outerDiameter": {
|
||||
"type": "Number",
|
||||
"value": 0.546875,
|
||||
"ty": {
|
||||
"type": "Unknown"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
122,
|
||||
124,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceRange": [
|
||||
127,
|
||||
129,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"outerProfile": {
|
||||
"type": "Sketch",
|
||||
"value": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from": [
|
||||
0.2734,
|
||||
0.0
|
||||
],
|
||||
"radius": 0.2734375,
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"to": [
|
||||
0.2734,
|
||||
0.0
|
||||
],
|
||||
"type": "Circle",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
}
|
||||
}
|
||||
],
|
||||
"on": {
|
||||
"type": "plane",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "XY",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"xAxis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"yAxis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"zAxis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"arc000": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "arc000",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"radius": 0.2734375,
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"to": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"type": "Circle",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
}
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"type": "extrudeArc"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
357,
|
||||
364,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"pipe": {
|
||||
"type": "Solid",
|
||||
"value": {
|
||||
"type": "Solid",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": [
|
||||
{
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"type": "extrudeArc"
|
||||
}
|
||||
],
|
||||
"sketch": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from": [
|
||||
0.2734,
|
||||
0.0
|
||||
],
|
||||
"radius": 0.2734375,
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"to": [
|
||||
0.2734,
|
||||
0.0
|
||||
],
|
||||
"type": "Circle",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
}
|
||||
}
|
||||
],
|
||||
"on": {
|
||||
"type": "plane",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "XY",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"xAxis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"yAxis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"zAxis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"arc000": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "arc000",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"radius": 0.2734375,
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"to": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"type": "Circle",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
}
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"type": "extrudeArc"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
357,
|
||||
364,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"height": 1.5,
|
||||
"startCapId": "[uuid]",
|
||||
"endCapId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"pipeProfile": {
|
||||
"type": "Sketch",
|
||||
"value": {
|
||||
"type": "Sketch",
|
||||
"id": "[uuid]",
|
||||
"paths": [
|
||||
{
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from": [
|
||||
0.2734,
|
||||
0.0
|
||||
],
|
||||
"radius": 0.2734375,
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"to": [
|
||||
0.2734,
|
||||
0.0
|
||||
],
|
||||
"type": "Circle",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
}
|
||||
}
|
||||
],
|
||||
"on": {
|
||||
"type": "plane",
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "XY",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"xAxis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"yAxis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"zAxis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"__meta": []
|
||||
},
|
||||
"start": {
|
||||
"from": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"tag": null,
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"arc000": {
|
||||
"type": "TagIdentifier",
|
||||
"value": "arc000",
|
||||
"info": {
|
||||
"type": "TagEngineInfo",
|
||||
"id": "[uuid]",
|
||||
"sketch": "[uuid]",
|
||||
"path": {
|
||||
"__geoMeta": {
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ccw": true,
|
||||
"center": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"radius": 0.2734375,
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"to": [
|
||||
0.2734375,
|
||||
0.0
|
||||
],
|
||||
"type": "Circle",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
}
|
||||
},
|
||||
"surface": {
|
||||
"faceId": "[uuid]",
|
||||
"id": "[uuid]",
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
],
|
||||
"tag": {
|
||||
"end": 364,
|
||||
"start": 357,
|
||||
"type": "TagDeclarator",
|
||||
"value": "arc000"
|
||||
},
|
||||
"type": "extrudeArc"
|
||||
}
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
357,
|
||||
364,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"artifactId": "[uuid]",
|
||||
"originalId": "[uuid]",
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"__meta": [
|
||||
{
|
||||
"sourceRange": [
|
||||
282,
|
||||
365,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sketch000": {
|
||||
"type": "Plane",
|
||||
"value": {
|
||||
"id": "[uuid]",
|
||||
"artifactId": "[uuid]",
|
||||
"value": "XY",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"xAxis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"yAxis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"zAxis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"units": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"__meta": []
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
src/wasm-lib/kcl/tests/flush_batch_on_end/rendered_model.png
Normal file
BIN
src/wasm-lib/kcl/tests/flush_batch_on_end/rendered_model.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
@ -2024,3 +2024,55 @@ async fn kcl_test_error_no_auth_websocket() {
|
||||
.to_string()
|
||||
.contains("Please send the following object over this websocket"));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn kcl_test_ensure_nothing_left_in_batch_single_file() {
|
||||
let code = r#"@settings(defaultLengthUnit = in)
|
||||
// Set units in inches (in)
|
||||
|
||||
|
||||
// Define constants
|
||||
innerDiameter = 0.364
|
||||
outerDiameter = 35 / 64
|
||||
length = 1 + 1 / 2
|
||||
|
||||
// create a sketch on the 'XY' plane
|
||||
sketch000 = startSketchOn('XY')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [0, innerDiameter / 2])
|
||||
"#;
|
||||
|
||||
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default())
|
||||
.await
|
||||
.unwrap();
|
||||
let mut exec_state = kcl_lib::ExecState::new(&ctx.settings);
|
||||
let program = kcl_lib::Program::parse_no_errs(code).unwrap();
|
||||
ctx.run_with_ui_outputs(&program, &mut exec_state).await.unwrap();
|
||||
|
||||
// Ensure nothing is left in the batch
|
||||
assert!(ctx.engine.batch().read().await.is_empty());
|
||||
assert!(ctx.engine.batch_end().read().await.is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn kcl_test_ensure_nothing_left_in_batch_multi_file() {
|
||||
// Get the current working directory.
|
||||
let current_dir = std::env::current_dir().unwrap();
|
||||
// Get the code in the test directory we need.
|
||||
let path = current_dir.join("kcl/tests/assembly_non_default_units/input.kcl");
|
||||
let code = std::fs::read_to_string(&path).unwrap();
|
||||
|
||||
// Change the current working directory to the test directory.
|
||||
std::env::set_current_dir(path.parent().unwrap()).unwrap();
|
||||
|
||||
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default())
|
||||
.await
|
||||
.unwrap();
|
||||
let mut exec_state = kcl_lib::ExecState::new(&ctx.settings);
|
||||
let program = kcl_lib::Program::parse_no_errs(&code).unwrap();
|
||||
ctx.run_with_ui_outputs(&program, &mut exec_state).await.unwrap();
|
||||
|
||||
// Ensure nothing is left in the batch
|
||||
assert!(ctx.engine.batch().read().await.is_empty());
|
||||
assert!(ctx.engine.batch_end().read().await.is_empty());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user