mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-30 16:47:25 +00:00
Merge pull request #7497 from smores56/new-interpolation-syntax
Move to new interpolation syntax
This commit is contained in:
commit
528d1d2b69
66 changed files with 630 additions and 596 deletions
|
@ -1,2 +1,2 @@
|
|||
"$(g)" : q
|
||||
"${g}" : q
|
||||
f
|
|
@ -1,2 +1,2 @@
|
|||
"""$(g)""":q
|
||||
"""${g}""":q
|
||||
f
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
"""
|
||||
"$(i
|
||||
"${i
|
||||
"""
|
||||
""")"
|
||||
"""}"
|
|
@ -1 +1 @@
|
|||
"""""""$(i"""""")"
|
||||
"""""""${i""""""}"
|
|
@ -1,8 +1,8 @@
|
|||
"""
|
||||
$({
|
||||
${{
|
||||
}
|
||||
i)
|
||||
$({
|
||||
i}
|
||||
${{
|
||||
}
|
||||
i)
|
||||
i}
|
||||
"""
|
|
@ -1,4 +1,4 @@
|
|||
"""$({
|
||||
}i)
|
||||
$({
|
||||
}i)"""
|
||||
"""${{
|
||||
}i}
|
||||
${{
|
||||
}i}"""
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
"$(S #
|
||||
)"
|
||||
"${S #
|
||||
}"
|
|
@ -1,2 +1,2 @@
|
|||
"$((S#
|
||||
))"
|
||||
"${(S#
|
||||
)}"
|
||||
|
|
|
@ -3,5 +3,5 @@ main =
|
|||
|> List.dropFirst 1
|
||||
|> List.mapTry? Str.toU8
|
||||
|> List.sum
|
||||
|> \total -> "Sum of numbers: $(Num.to_str total)"
|
||||
|> \total -> "Sum of numbers: ${Num.to_str total}"
|
||||
|> Str.toUpper
|
||||
|
|
|
@ -6575,13 +6575,13 @@ mod test_fmt {
|
|||
expr_formats_to(
|
||||
indoc!(
|
||||
"
|
||||
x = \"foo:\u{200B} $(bar).\"
|
||||
x = \"foo:\u{200B} ${bar}.\"
|
||||
x
|
||||
"
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
x = "foo:\u(200b) $(bar)."
|
||||
x = "foo:\u(200b) ${bar}."
|
||||
x
|
||||
"#
|
||||
),
|
||||
|
@ -6595,7 +6595,7 @@ mod test_fmt {
|
|||
"
|
||||
x =
|
||||
\"\"\"
|
||||
foo:\u{200B} $(bar).
|
||||
foo:\u{200B} ${bar}.
|
||||
\"\"\"
|
||||
x
|
||||
"
|
||||
|
@ -6604,7 +6604,7 @@ mod test_fmt {
|
|||
r#"
|
||||
x =
|
||||
"""
|
||||
foo:\u(200b) $(bar).
|
||||
foo:\u(200b) ${bar}.
|
||||
"""
|
||||
x
|
||||
"#
|
||||
|
|
|
@ -1036,7 +1036,7 @@ mod test_snapshots {
|
|||
|
||||
#[test]
|
||||
fn string_with_interpolation_in_middle() {
|
||||
assert_segments(r#""Hi, $(name)!""#, |arena| {
|
||||
assert_segments(r#""Hi, ${name}!""#, |arena| {
|
||||
let expr = arena.alloc(Var {
|
||||
module_name: "",
|
||||
ident: "name",
|
||||
|
@ -1052,7 +1052,7 @@ mod test_snapshots {
|
|||
|
||||
#[test]
|
||||
fn string_with_interpolation_in_front() {
|
||||
assert_segments(r#""$(name), hi!""#, |arena| {
|
||||
assert_segments(r#""${name}, hi!""#, |arena| {
|
||||
let expr = arena.alloc(Var {
|
||||
module_name: "",
|
||||
ident: "name",
|
||||
|
@ -1067,7 +1067,7 @@ mod test_snapshots {
|
|||
|
||||
#[test]
|
||||
fn string_with_interpolation_in_back() {
|
||||
assert_segments(r#""Hello $(name)""#, |arena| {
|
||||
assert_segments(r#""Hello ${name}""#, |arena| {
|
||||
let expr = arena.alloc(Var {
|
||||
module_name: "",
|
||||
ident: "name",
|
||||
|
@ -1082,7 +1082,7 @@ mod test_snapshots {
|
|||
|
||||
#[test]
|
||||
fn string_with_multiple_interpolations() {
|
||||
assert_segments(r#""Hi, $(name)! How is $(project) going?""#, |arena| {
|
||||
assert_segments(r#""Hi, ${name}! How is ${project} going?""#, |arena| {
|
||||
let expr1 = arena.alloc(Var {
|
||||
module_name: "",
|
||||
ident: "name",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue