add tests

This commit is contained in:
Folkert 2021-03-04 15:46:55 +01:00
parent 0bc4d2c514
commit 14d389e5d1

View file

@ -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]
fn list_join_empty_list() {
assert_evals_to!("List.join []", RocList::from_slice(&[]), RocList<i64>);