mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Add base piping for list.Replace
This commit is contained in:
parent
279652a5af
commit
ba2e8cd32b
14 changed files with 315 additions and 16 deletions
|
@ -1702,6 +1702,40 @@ fn get_int_list_oob() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn replace_unique_int_list() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
result = List.replace [ 12, 9, 7, 1, 5 ] 2 33
|
||||
when result is
|
||||
Ok (Pair newList _) -> newList
|
||||
Err _ -> []
|
||||
"#
|
||||
),
|
||||
RocList::from_slice(&[12, 9, 33, 1, 5]),
|
||||
RocList<i64>
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn replace_unique_int_list_get_old_value() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
result = List.replace [ 12, 9, 7, 1, 5 ] 2 33
|
||||
when result is
|
||||
Ok (Pair _ oldValue) -> oldValue
|
||||
Err _ -> -1
|
||||
"#
|
||||
),
|
||||
7,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn get_set_unique_int_list() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue