use RocResult in addChecked test

This commit is contained in:
Folkert 2022-08-23 20:10:05 +02:00
parent a44afd1383
commit b43c0ac1e3
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -11,7 +11,7 @@ use crate::helpers::wasm::assert_evals_to;
#[allow(unused_imports)] #[allow(unused_imports)]
use indoc::indoc; use indoc::indoc;
#[allow(unused_imports)] #[allow(unused_imports)]
use roc_std::{RocDec, RocOrder}; use roc_std::{RocDec, RocOrder, RocResult};
#[test] #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))] #[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
@ -1791,30 +1791,22 @@ fn int_add_overflow() {
} }
#[test] #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn int_add_checked() { fn int_add_checked_ok() {
assert_evals_to!( assert_evals_to!(
indoc!( "Num.addChecked 1 2",
r#" RocResult::ok(3),
when Num.addChecked 1 2 is RocResult<i64, ()>
Ok v -> v
_ -> -1
"#
),
3,
i64
); );
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn int_add_checked_err() {
assert_evals_to!( assert_evals_to!(
indoc!( "Num.addChecked 9_223_372_036_854_775_807 1",
r#" RocResult::err(()),
when Num.addChecked 9_223_372_036_854_775_807 1 is RocResult<i64, ()>
Err Overflow -> -1
Ok v -> v
"#
),
-1,
i64
); );
} }