@ -31,7 +31,19 @@ async fn cache_test(
 | 
			
		||||
        // set the new settings.
 | 
			
		||||
        ctx.settings = variation.settings.clone();
 | 
			
		||||
 | 
			
		||||
        let outcome = ctx.run_with_caching(program).await.unwrap();
 | 
			
		||||
        let outcome = match ctx.run_with_caching(program).await {
 | 
			
		||||
            Ok(outcome) => outcome,
 | 
			
		||||
            Err(err) => {
 | 
			
		||||
                miette::set_hook(Box::new(|_| {
 | 
			
		||||
                    Box::new(miette::MietteHandlerOpts::new().show_related_errors_as_nested().build())
 | 
			
		||||
                }))
 | 
			
		||||
                .unwrap();
 | 
			
		||||
                let report = err.clone().into_miette_report_with_outputs(variation.code).unwrap();
 | 
			
		||||
                let report = miette::Report::new(report);
 | 
			
		||||
                let report = format!("{:?}", report);
 | 
			
		||||
                panic!("Error: {}", report);
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        let snapshot_png_bytes = ctx.prepare_snapshot().await.unwrap().contents.0;
 | 
			
		||||
 | 
			
		||||
        // Decode the snapshot, return it.
 | 
			
		||||
@ -282,3 +294,33 @@ async fn kcl_test_cache_empty_file_pop_cache_empty_file_planes_work() {
 | 
			
		||||
 | 
			
		||||
    ctx.close().await;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[tokio::test(flavor = "multi_thread")]
 | 
			
		||||
async fn kcl_test_cache_fillet_error_opening_closing_specific_files() {
 | 
			
		||||
    let main_code = include_str!("../../tests/fillet_error_switch_files/main.kcl");
 | 
			
		||||
    let switch_code = include_str!("../../tests/fillet_error_switch_files/switch_protector.kcl");
 | 
			
		||||
 | 
			
		||||
    let result = cache_test(
 | 
			
		||||
        "fillet_error_opening_closing_specific_files",
 | 
			
		||||
        vec![
 | 
			
		||||
            Variation {
 | 
			
		||||
                code: main_code,
 | 
			
		||||
                settings: &Default::default(),
 | 
			
		||||
            },
 | 
			
		||||
            Variation {
 | 
			
		||||
                code: switch_code,
 | 
			
		||||
                settings: &Default::default(),
 | 
			
		||||
            },
 | 
			
		||||
            Variation {
 | 
			
		||||
                code: main_code,
 | 
			
		||||
                settings: &Default::default(),
 | 
			
		||||
            },
 | 
			
		||||
        ],
 | 
			
		||||
    )
 | 
			
		||||
    .await;
 | 
			
		||||
 | 
			
		||||
    // Make sure nothing failed.
 | 
			
		||||
    result.first().unwrap();
 | 
			
		||||
    result.get(1).unwrap();
 | 
			
		||||
    result.last().unwrap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 56 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 98 KiB  | 
@ -693,6 +693,10 @@ impl ExecutorContext {
 | 
			
		||||
        .await;
 | 
			
		||||
 | 
			
		||||
        let outcome = exec_state.to_wasm_outcome(result.0).await;
 | 
			
		||||
 | 
			
		||||
        println!("batch_end: {:#?}", self.engine.batch_end().read().await);
 | 
			
		||||
        println!("responses: {:#?}", self.engine.responses().read().await);
 | 
			
		||||
        println!("batch: {:#?}", self.engine.batch().read().await);
 | 
			
		||||
        Ok(outcome)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										71
									
								
								rust/kcl-lib/tests/fillet_error_switch_files/main.kcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								rust/kcl-lib/tests/fillet_error_switch_files/main.kcl
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,71 @@
 | 
			
		||||
holeFudge = 0.4
 | 
			
		||||
frontBarD = 5.0
 | 
			
		||||
yBarD = 6.7
 | 
			
		||||
slideGap = 0.7
 | 
			
		||||
lowerBlockTransHole = {
 | 
			
		||||
  r = (frontBarD + slideGap + holeFudge) / 2
 | 
			
		||||
}
 | 
			
		||||
upperBlockLongHole = { r = (yBarD + holeFudge) / 2 }
 | 
			
		||||
 | 
			
		||||
upperBlockTransHole = { r = (yBarD + holeFudge) / 2 }
 | 
			
		||||
tubeClr = 1.5
 | 
			
		||||
lowerBlock = {
 | 
			
		||||
  h = 2 * lowerBlockTransHole.r + 2 * tubeClr,
 | 
			
		||||
  l = 70
 | 
			
		||||
}
 | 
			
		||||
upperBlock = {
 | 
			
		||||
  h = 2 * upperBlockLongHole.r + 2 * tubeClr,
 | 
			
		||||
  l = 25
 | 
			
		||||
}
 | 
			
		||||
elevate = { h = 5 }
 | 
			
		||||
 | 
			
		||||
blockSz = max(upperBlock.h, lowerBlock.h)
 | 
			
		||||
 | 
			
		||||
slot = { l = 10, h = 1 }
 | 
			
		||||
 | 
			
		||||
sketch001 = startSketchOn(XZ)
 | 
			
		||||
  |> startProfileAt([0, 0], %)
 | 
			
		||||
  |> yLine(length = blockSz, tag = $edgeA)
 | 
			
		||||
  |> xLine(length = blockSz, tag = $edgeB)
 | 
			
		||||
  |> yLine(length = -blockSz, tag = $edgeC)
 | 
			
		||||
  |> xLine(length = upperBlock.l - blockSz, tag = $edge1)
 | 
			
		||||
  |> yLine(length = -(elevate.h + blockSz), tag = $edge2)
 | 
			
		||||
  |> xLine(length = lowerBlock.l - blockSz, tag = $edge3)
 | 
			
		||||
  |> yLine(length = -blockSz, tag = $edge4)
 | 
			
		||||
  |> xLine(length = -lowerBlock.l, tag = $edge5)
 | 
			
		||||
  |> yLine(length = blockSz + elevate.h, tag = $edge6)
 | 
			
		||||
  |> xLine(length = -(upperBlock.l - blockSz), tag = $edge7)
 | 
			
		||||
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg01)
 | 
			
		||||
  |> close(%)
 | 
			
		||||
  |> hole(circle(center = [blockSz / 2, blockSz / 2], radius = upperBlockTransHole.r), %)
 | 
			
		||||
  |> hole(circle(
 | 
			
		||||
       center = [
 | 
			
		||||
         upperBlock.l + lowerBlock.l - blockSz - lowerBlockTransHole.r - tubeClr,
 | 
			
		||||
         -(blockSz + elevate.h + blockSz / 2)
 | 
			
		||||
       ],
 | 
			
		||||
       radius = lowerBlockTransHole.r,
 | 
			
		||||
     ), %)
 | 
			
		||||
rad = 3
 | 
			
		||||
 | 
			
		||||
extrude001 = extrude(sketch001, length = blockSz)
 | 
			
		||||
  |> fillet(
 | 
			
		||||
       radius = rad,
 | 
			
		||||
       tags = [
 | 
			
		||||
         getNextAdjacentEdge(edgeA),
 | 
			
		||||
         getNextAdjacentEdge(edgeB),
 | 
			
		||||
         getNextAdjacentEdge(edgeC),
 | 
			
		||||
         getNextAdjacentEdge(edge1),
 | 
			
		||||
         getNextAdjacentEdge(edge2),
 | 
			
		||||
         getNextAdjacentEdge(edge3),
 | 
			
		||||
         getNextAdjacentEdge(edge4),
 | 
			
		||||
         getNextAdjacentEdge(edge5),
 | 
			
		||||
         getNextAdjacentEdge(edge6),
 | 
			
		||||
         getNextAdjacentEdge(edge7)
 | 
			
		||||
       ],
 | 
			
		||||
     )
 | 
			
		||||
 | 
			
		||||
sketch002 = startSketchOn(extrude001, seg01)
 | 
			
		||||
  |> startProfileAt([0, 0], %)
 | 
			
		||||
  |> circle(center = [blockSz / 2, -blockSz / 2], radius = upperBlockLongHole.r)
 | 
			
		||||
  |> extrude(length = -upperBlock.l)
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,24 @@
 | 
			
		||||
holeFudgeD = 0.4
 | 
			
		||||
holeFudgeR = holeFudgeD / 2
 | 
			
		||||
 | 
			
		||||
totalH = 12.5
 | 
			
		||||
switchNutD = 9.5
 | 
			
		||||
switchNutR = switchNutD / 2
 | 
			
		||||
bottomInnerR = switchNutR + holeFudgeR
 | 
			
		||||
bottomOuterR = 13.5
 | 
			
		||||
topInnerR = switchNutR + 1.5 + holeFudgeR
 | 
			
		||||
topFlatL = 1
 | 
			
		||||
topOuterR = topInnerR + topFlatL
 | 
			
		||||
baseH = 1
 | 
			
		||||
coneH = totalH - baseH
 | 
			
		||||
 | 
			
		||||
sketch001 = startSketchOn(XZ)
 | 
			
		||||
  |> startProfileAt([bottomInnerR, 0], %)
 | 
			
		||||
  |> xLine(endAbsolute = bottomOuterR)
 | 
			
		||||
  |> yLine(length = baseH)
 | 
			
		||||
  |> line(end = [-(bottomOuterR - topOuterR), coneH])
 | 
			
		||||
  |> line(end = [-(topOuterR - topInnerR), 0])
 | 
			
		||||
  |> close(%)
 | 
			
		||||
  |> revolve(axis = Y)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user