mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
use RocResult for some tests
This commit is contained in:
parent
1b29aa3e43
commit
b9adbf66a0
1 changed files with 10 additions and 33 deletions
|
@ -13,7 +13,7 @@ use crate::helpers::dev::assert_evals_to as assert_llvm_evals_to;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use indoc::indoc;
|
use indoc::indoc;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use roc_std::{RocList, RocStr};
|
use roc_std::{RocList, RocResult, RocStr};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm"))]
|
||||||
|
@ -103,18 +103,9 @@ fn str_split_str_concat_repeated() {
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm"))]
|
||||||
fn str_split_small_str_bigger_delimiter() {
|
fn str_split_small_str_bigger_delimiter() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(r#"Str.split "JJJ" "0123456789abcdefghi""#),
|
||||||
r#"
|
RocList::from_slice(&[RocStr::from("JJJ")]),
|
||||||
when
|
RocList<RocStr>
|
||||||
List.first
|
|
||||||
(Str.split "JJJ" "0123456789abcdefghi")
|
|
||||||
is
|
|
||||||
Ok str -> str
|
|
||||||
_ -> ""
|
|
||||||
"#
|
|
||||||
),
|
|
||||||
RocStr::from("JJJ"),
|
|
||||||
RocStr
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1442,16 +1433,9 @@ fn str_to_i64() {
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm"))]
|
||||||
fn str_to_u64() {
|
fn str_to_u64() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
r#"Str.toU64 "1""#,
|
||||||
r#"
|
RocResult::ok(1u64),
|
||||||
when Str.toU64 "1" is
|
RocResult<u64, u8>
|
||||||
Ok n -> n
|
|
||||||
Err _ -> 0
|
|
||||||
|
|
||||||
"#
|
|
||||||
),
|
|
||||||
1,
|
|
||||||
u64
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1476,16 +1460,9 @@ fn str_to_i32() {
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm"))]
|
||||||
fn str_to_u32() {
|
fn str_to_u32() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
r#"Str.toU32 "1""#,
|
||||||
r#"
|
RocResult::ok(1u32),
|
||||||
when Str.toU32 "1" is
|
RocResult<u32, u8>
|
||||||
Ok n -> n
|
|
||||||
Err _ -> 0
|
|
||||||
|
|
||||||
"#
|
|
||||||
),
|
|
||||||
1,
|
|
||||||
u32
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue