Merge branch 'trunk' into builtins-list-intersperse

This commit is contained in:
satotake 2021-11-18 11:16:27 +00:00 committed by GitHub
commit ce8a88416d
319 changed files with 4413 additions and 3654 deletions

View file

@ -248,6 +248,47 @@ fn list_sublist() {
);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn list_split() {
assert_evals_to!(
r#"
list = List.split [1, 2, 3] 0
list.before
"#,
RocList::from_slice(&[]),
RocList<i64>
);
assert_evals_to!(
r#"
list = List.split [1, 2, 3] 0
list.others
"#,
RocList::from_slice(&[1, 2, 3]),
RocList<i64>
);
assert_evals_to!(
"List.split [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",
(RocList::from_slice(&[1, 2, 3]), RocList::from_slice(&[]),),
(RocList<i64>, RocList<i64>,)
);
assert_evals_to!(
"List.split [1, 2, 3] 4",
(RocList::from_slice(&[1, 2, 3]), RocList::from_slice(&[]),),
(RocList<i64>, RocList<i64>,)
);
assert_evals_to!(
"List.split [] 1",
(RocList::from_slice(&[]), RocList::from_slice(&[]),),
(RocList<i64>, RocList<i64>,)
);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn list_drop() {