fix string split on overlapping delimiters

This commit is contained in:
Folkert 2023-01-27 17:35:10 +01:00
parent e5c0939bbe
commit d52c037cba
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 89 additions and 2 deletions

View file

@ -1801,6 +1801,26 @@ fn str_split_last_not_found() {
);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_split_overlapping_substring_1() {
assert_evals_to!(
r#"Str.split "aaa" "aa""#,
RocList::from_slice(&[RocStr::from(""), RocStr::from("a")]),
RocList<RocStr>
);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_split_overlapping_substring_2() {
assert_evals_to!(
r#"Str.split "aaaa" "aa""#,
RocList::from_slice(&[RocStr::from(""), RocStr::from(""), RocStr::from("")]),
RocList<RocStr>
);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_walk_utf8_with_index() {