Move to new interpolation syntax

This commit is contained in:
Sam Mohr 2025-01-10 10:18:15 -08:00
parent a69a326161
commit eb1b5ffa26
No known key found for this signature in database
GPG key ID: EA41D161A3C1BC99
68 changed files with 665 additions and 633 deletions

View file

@ -755,14 +755,14 @@ fn type_problem_unary_operator() {
#[test]
fn type_problem_string_interpolation() {
expect_failure(
"\"This is not a string -> $(1)\"",
"\"This is not a string -> ${1}\"",
indoc!(
r#"
TYPE MISMATCH
This argument to this string interpolation has an unexpected type:
4 "This is not a string -> $(1)"
4 "This is not a string -> ${1}"
^
The argument is a number of type:
@ -833,14 +833,14 @@ fn list_get_negative_index() {
#[test]
fn invalid_string_interpolation() {
expect_failure(
"\"$(123)\"",
"\"${123}\"",
indoc!(
r#"
TYPE MISMATCH
This argument to this string interpolation has an unexpected type:
4 "$(123)"
4 "${123}"
^^^
The argument is a number of type:
@ -1537,7 +1537,7 @@ fn interpolation_with_nested_strings() {
expect_success(
indoc!(
r#"
"foo $(Str.join_with ["a", "b", "c"] ", ") bar"
"foo ${Str.join_with ["a", "b", "c"] ", "} bar"
"#
),
r#""foo a, b, c bar" : Str"#,
@ -1549,7 +1549,7 @@ fn interpolation_with_num_to_str() {
expect_success(
indoc!(
r#"
"foo $(Num.to_str Num.max_i8) bar"
"foo ${Num.to_str Num.max_i8} bar"
"#
),
r#""foo 127 bar" : Str"#,
@ -1561,7 +1561,7 @@ fn interpolation_with_operator_desugaring() {
expect_success(
indoc!(
r#"
"foo $(Num.to_str (1 + 2)) bar"
"foo ${Num.to_str (1 + 2)} bar"
"#
),
r#""foo 3 bar" : Str"#,
@ -1576,7 +1576,7 @@ fn interpolation_with_nested_interpolation() {
expect_failure(
indoc!(
r#"
"foo $(Str.join_with ["a$(Num.to_str 5)", "b"] "c")"
"foo ${Str.join_with ["a${Num.to_str 5}", "b"] "c"}"
"#
),
indoc!(
@ -1585,7 +1585,7 @@ fn interpolation_with_nested_interpolation() {
This string interpolation is invalid:
4 "foo $(Str.join_with ["a$(Num.to_str 5)", "b"] "c")"
4 "foo ${Str.join_with ["a${Num.to_str 5}", "b"] "c"}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
String interpolations cannot contain newlines or other interpolations.