mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
Add builtin List.intersperse
This commit is contained in:
parent
8f25106b2c
commit
16fb04b4fa
5 changed files with 120 additions and 0 deletions
|
@ -277,6 +277,29 @@ fn list_drop_at() {
|
|||
assert_evals_to!("List.dropAt [0] 0", RocList::from_slice(&[]), RocList<i64>);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn list_intersperse() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
List.intersperse [0, 0, 0] 1
|
||||
"#
|
||||
),
|
||||
RocList::from_slice(&[0, 1, 0, 1, 0]),
|
||||
RocList<i64>
|
||||
);
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
List.intersperse [] 1
|
||||
"#
|
||||
),
|
||||
RocList::from_slice(&[]),
|
||||
RocList<i64>
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn list_drop_at_shared() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue