fix unwrap (#6825)
* fix unwrap Signed-off-by: Jess Frazelle <github@jessfraz.com> * add test Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * udaptes Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -2729,3 +2729,24 @@ mod involute_circular_units {
|
||||
super::execute(TEST_NAME, true).await
|
||||
}
|
||||
}
|
||||
mod panic_repro_cube {
|
||||
const TEST_NAME: &str = "panic_repro_cube";
|
||||
|
||||
/// Test parsing KCL.
|
||||
#[test]
|
||||
fn parse() {
|
||||
super::parse(TEST_NAME)
|
||||
}
|
||||
|
||||
/// Test that parsing and unparsing KCL produces the original KCL input.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn unparse() {
|
||||
super::unparse(TEST_NAME).await
|
||||
}
|
||||
|
||||
/// Test that KCL is executed correctly.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn kcl_test_execute() {
|
||||
super::execute(TEST_NAME, true).await
|
||||
}
|
||||
}
|
||||
|
@ -407,8 +407,15 @@ impl Args {
|
||||
})
|
||||
})?;
|
||||
|
||||
// TODO unnecessary cloning
|
||||
Ok(T::from_kcl_val(&arg).unwrap())
|
||||
T::from_kcl_val(&arg).ok_or_else(|| {
|
||||
KclError::Semantic(KclErrorDetails {
|
||||
source_ranges: vec![self.source_range],
|
||||
message: format!(
|
||||
"This function expected the input argument to be {}",
|
||||
ty.human_friendly_type(),
|
||||
),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Add a modeling command to the batch but don't fire it right away.
|
||||
|
Reference in New Issue
Block a user