mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
builtin(str): implement withCapacity
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
This commit is contained in:
parent
f0786121fb
commit
9013e4ce11
11 changed files with 59 additions and 2 deletions
|
@ -1930,3 +1930,31 @@ fn when_on_strings() {
|
|||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn with_capacity() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
Str.withCapacity 10
|
||||
"#
|
||||
),
|
||||
RocStr::from(""),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn with_capacity_concat() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
Str.withCapacity 10 |> Str.concat "Forty-two"
|
||||
"#
|
||||
),
|
||||
RocStr::from("Forty-two"),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue