mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
add extra test case from issue
This commit is contained in:
parent
c5a74bdc12
commit
a81d4b8b16
1 changed files with 28 additions and 1 deletions
|
@ -4667,7 +4667,7 @@ fn multiple_uses_of_bool_true_tag_union() {
|
|||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
|
||||
fn issue_6139() {
|
||||
fn issue_6139_contains() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
|
@ -4701,3 +4701,30 @@ fn issue_6139() {
|
|||
RocList<RocStr>
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
|
||||
fn issue_6139_prefixes() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
prefixes = \str, soFar ->
|
||||
if Str.isEmpty str then
|
||||
soFar
|
||||
|
||||
else
|
||||
graphemes =
|
||||
Str.toUtf8 str
|
||||
|> List.map \c -> Str.fromUtf8 [c] |> Result.withDefault ""
|
||||
remaining = List.dropFirst graphemes 1
|
||||
next = Str.joinWith remaining ""
|
||||
|
||||
prefixes next (List.append soFar str)
|
||||
|
||||
prefixes "abc" []
|
||||
"#
|
||||
),
|
||||
RocList::from_slice(&[RocStr::from("abc"), RocStr::from("bc"), RocStr::from("c")]),
|
||||
RocList<RocStr>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue