force interpolated variables to be of type string

This commit is contained in:
Folkert 2024-01-30 14:26:12 +01:00
parent fec42d8654
commit 21b540751a
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 72 additions and 11 deletions

View file

@ -813,6 +813,32 @@ fn list_get_negative_index() {
);
}
#[cfg(not(feature = "wasm"))] // TODO: mismatch is due to terminal control codes!
#[test]
fn invalid_string_interpolation() {
expect_failure(
"\"$(123)\"",
indoc!(
r#"
TYPE MISMATCH
This argument to this string interpolation has an unexpected type:
4 "$(123)"
^^^
The argument is a number of type:
Num *
But this string interpolation needs its argument to be:
Str
"#
),
);
}
#[test]
fn issue_2149_i8_ok() {
expect_success(r#"Str.toI8 "127""#, "Ok 127 : Result I8 [InvalidNumStr]");