mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
add List.splitAt
This commit is contained in:
parent
b7c2cb084e
commit
45b50bd131
54 changed files with 1479 additions and 1469 deletions
|
@ -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(&[]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue