mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
add tests
This commit is contained in:
parent
0bc4d2c514
commit
14d389e5d1
1 changed files with 29 additions and 0 deletions
|
@ -568,6 +568,35 @@ fn list_map_closure() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn list_map2_pair() {
|
||||||
|
assert_evals_to!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
List.map2 [1,2,3] [3,2,1] (\a,b -> Pair a b)
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
RocList::from_slice(&[(1, 3), (2, 2), (3, 1)]),
|
||||||
|
RocList<(i64, i64)>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn list_map2_different_lengths() {
|
||||||
|
assert_evals_to!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
List.map2
|
||||||
|
["a", "b", "lllllllllllllongnggg" ]
|
||||||
|
["b"]
|
||||||
|
Str.concat
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
RocList::from_slice(&[RocStr::from_slice("ab".as_bytes()),]),
|
||||||
|
RocList<RocStr>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn list_join_empty_list() {
|
fn list_join_empty_list() {
|
||||||
assert_evals_to!("List.join []", RocList::from_slice(&[]), RocList<i64>);
|
assert_evals_to!("List.join []", RocList::from_slice(&[]), RocList<i64>);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue