mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
builtin(str): add withPrefix
Closes #4142 Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
This commit is contained in:
parent
f0786121fb
commit
d6526fa425
3 changed files with 30 additions and 0 deletions
|
@ -1930,3 +1930,27 @@ fn when_on_strings() {
|
|||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn str_with_prefix() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
Str.withPrefix "world!" "Hello "
|
||||
"#
|
||||
),
|
||||
RocStr::from("Hello world!"),
|
||||
RocStr
|
||||
);
|
||||
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
"two" |> Str.withPrefix "Forty "
|
||||
"#
|
||||
),
|
||||
RocStr::from("Forty two"),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue