adding initial List.all

This commit is contained in:
Michael Downey 2021-11-16 16:34:36 -05:00
parent b03ed18553
commit d946b84e63
17 changed files with 160 additions and 4 deletions

View file

@ -2352,6 +2352,28 @@ fn list_any_empty_with_unknown_element_type() {
assert_evals_to!("List.any [] (\\_ -> True)", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn list_all() {
assert_evals_to!("List.all [] (\\e -> e > 3)", false, bool);
assert_evals_to!("List.all [ 1, 2, 3 ] (\\e -> e > 3)", false, bool);
assert_evals_to!("List.all [ 1, 2, 4 ] (\\e -> e > 3)", false, bool);
assert_evals_to!("List.all [ 1, 2, 3 ] (\\e -> e >= 1", true, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
#[should_panic(expected = r#"Roc failed with message: "UnresolvedTypeVar"#)]
fn list_all_empty_with_unknown_element_type() {
// Segfaults with invalid memory reference. Running this as a stand-alone
// Roc program, generates the following error message:
//
// Application crashed with message
// UnresolvedTypeVar compiler/mono/src/ir.rs line 3775
// Shutting down
assert_evals_to!("List.all [] (\\_ -> True)", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
#[should_panic(expected = r#"Roc failed with message: "invalid ret_layout""#)]