add List.splitAt

This commit is contained in:
Isaac Van Doren 2024-11-09 14:16:41 -06:00
parent b7c2cb084e
commit 45b50bd131
No known key found for this signature in database
GPG key ID: CFA524CD470E5B94
54 changed files with 1479 additions and 1469 deletions

View file

@ -371,10 +371,10 @@ fn list_map_try_err() {
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_split() {
fn list_split_at() {
assert_evals_to!(
r"
list = List.split [1, 2, 3] 0
list = List.splitAt [1, 2, 3] 0
list.before
",
RocList::<i64>::from_slice(&[]),
@ -382,7 +382,7 @@ fn list_split() {
);
assert_evals_to!(
r"
list = List.split [1, 2, 3] 0
list = List.splitAt [1, 2, 3] 0
list.others
",
RocList::from_slice(&[1, 2, 3]),
@ -390,13 +390,13 @@ fn list_split() {
);
assert_evals_to!(
r"
List.split [1, 2, 3] 1
List.splitAt [1, 2, 3] 1
",
(RocList::from_slice(&[1]), RocList::from_slice(&[2, 3])),
(RocList<i64>, RocList<i64>,)
);
assert_evals_to!(
"List.split [1, 2, 3] 3",
"List.splitAt [1, 2, 3] 3",
(
RocList::from_slice(&[1, 2, 3]),
RocList::<i64>::from_slice(&[]),
@ -404,7 +404,7 @@ fn list_split() {
(RocList<i64>, RocList<i64>,)
);
assert_evals_to!(
"List.split [1, 2, 3] 4",
"List.splitAt [1, 2, 3] 4",
(
RocList::from_slice(&[1, 2, 3]),
RocList::<i64>::from_slice(&[]),
@ -412,7 +412,7 @@ fn list_split() {
(RocList<i64>, RocList<i64>,)
);
assert_evals_to!(
"List.split [] 1",
"List.splitAt [] 1",
(
RocList::<i64>::from_slice(&[]),
RocList::<i64>::from_slice(&[]),