resolve review comments

This commit is contained in:
Luke Boswell 2024-08-14 17:24:12 +10:00
parent 45f18bd64e
commit 6bae15c467
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
2 changed files with 42 additions and 5 deletions

View file

@ -357,7 +357,7 @@ fn roc_result_after_err() {
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn roc_result_map_other() {
fn roc_result_map_both() {
assert_evals_to!(
indoc!(
r#"
@ -383,7 +383,11 @@ fn roc_result_map_other() {
RocResult::err(RocStr::from("24")),
RocResult<RocStr, RocStr>
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn roc_result_map_two() {
assert_evals_to!(
indoc!(
r#"
@ -399,4 +403,36 @@ fn roc_result_map_other() {
RocResult::ok(14i64),
RocResult<i64, RocStr>
);
assert_evals_to!(
indoc!(
r#"
first : Result I64 Str
first = Err "foo"
second : Result I64 Str
second = Err "bar"
Result.map2 first second \a, b -> a + b
"#
),
RocResult::err(RocStr::from("foo")),
RocResult<i64, RocStr>
);
assert_evals_to!(
indoc!(
r#"
first : Result I64 Str
first = Ok 42
second : Result I64 Str
second = Err "bar"
Result.map2 first second \a, b -> a + b
"#
),
RocResult::err(RocStr::from("bar")),
RocResult<i64, RocStr>
);
}