mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
test: update tests to use Num.toStr
This commit is contained in:
parent
00bd77bf1d
commit
40090f20e6
5 changed files with 42 additions and 88 deletions
|
@ -527,40 +527,6 @@ fn str_starts_with_false_small_str() {
|
|||
assert_evals_to!(r#"Str.startsWith "1234" "23""#, false, bool);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn str_from_int() {
|
||||
assert_evals_to!(
|
||||
r#"Str.fromInt 1234"#,
|
||||
roc_std::RocStr::from_slice("1234".as_bytes()),
|
||||
roc_std::RocStr
|
||||
);
|
||||
assert_evals_to!(
|
||||
r#"Str.fromInt 0"#,
|
||||
roc_std::RocStr::from_slice("0".as_bytes()),
|
||||
roc_std::RocStr
|
||||
);
|
||||
assert_evals_to!(
|
||||
r#"Str.fromInt -1"#,
|
||||
roc_std::RocStr::from_slice("-1".as_bytes()),
|
||||
roc_std::RocStr
|
||||
);
|
||||
|
||||
let max = format!("{}", i64::MAX);
|
||||
assert_evals_to!(
|
||||
r#"Str.fromInt Num.maxInt"#,
|
||||
RocStr::from_slice(max.as_bytes()),
|
||||
RocStr
|
||||
);
|
||||
|
||||
let min = format!("{}", i64::MIN);
|
||||
assert_evals_to!(
|
||||
r#"Str.fromInt Num.minInt"#,
|
||||
RocStr::from_slice(min.as_bytes()),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn str_from_utf8_pass_single_ascii() {
|
||||
|
@ -838,8 +804,8 @@ fn nested_recursive_literal() {
|
|||
|> Str.concat ") ("
|
||||
|> Str.concat (printExpr b)
|
||||
|> Str.concat ")"
|
||||
Val v -> "Val " |> Str.concat (Str.fromInt v)
|
||||
Var v -> "Var " |> Str.concat (Str.fromInt v)
|
||||
Val v -> "Val " |> Str.concat (Num.toStr v)
|
||||
Var v -> "Var " |> Str.concat (Num.toStr v)
|
||||
|
||||
printExpr expr
|
||||
"#
|
||||
|
@ -875,12 +841,6 @@ fn str_join_comma_single() {
|
|||
assert_evals_to!(r#"Str.joinWith ["1"] ", " "#, RocStr::from("1"), RocStr);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn str_from_float() {
|
||||
assert_evals_to!(r#"Str.fromFloat 3.14"#, RocStr::from("3.14"), RocStr);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn str_to_utf8() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue