Better String parameter error message.
This commit is contained in:
parent
5fb4b04cb0
commit
a4cabc1ac7
@ -708,7 +708,11 @@ impl Engine {
|
|||||||
"{} ({})",
|
"{} ({})",
|
||||||
fn_name,
|
fn_name,
|
||||||
args.iter()
|
args.iter()
|
||||||
.map(|name| self.map_type_name(name.type_name()))
|
.map(|name| if name.is::<ImmutableString>() {
|
||||||
|
"&str | ImmutableString"
|
||||||
|
} else {
|
||||||
|
self.map_type_name(name.type_name())
|
||||||
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(", ")
|
.join(", ")
|
||||||
),
|
),
|
||||||
|
@ -8,7 +8,7 @@ fn test_decrement() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine.eval::<String>(r#"let s = "test"; s -= "ing"; s"#).expect_err("expects error"),
|
*engine.eval::<String>(r#"let s = "test"; s -= "ing"; s"#).expect_err("expects error"),
|
||||||
EvalAltResult::ErrorFunctionNotFound(err, _) if err == "- (string, string)"
|
EvalAltResult::ErrorFunctionNotFound(err, _) if err == "- (&str | ImmutableString, &str | ImmutableString)"
|
||||||
));
|
));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -168,7 +168,7 @@ fn test_string_fn() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine.eval::<INT>(r#"foo3("hello")"#).expect_err("should error"),
|
*engine.eval::<INT>(r#"foo3("hello")"#).expect_err("should error"),
|
||||||
EvalAltResult::ErrorFunctionNotFound(ref x, _) if x == "foo3 (string)"
|
EvalAltResult::ErrorFunctionNotFound(err, _) if err == "foo3 (&str | ImmutableString)"
|
||||||
));
|
));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user