mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Merge pull request #2002 from rtfeldman/builtins-list-intersperse
Add builtin `List.intersperse`
This commit is contained in:
commit
a4fc813ca3
5 changed files with 124 additions and 2 deletions
|
@ -318,6 +318,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