fix string repeat tests

This commit is contained in:
Folkert 2022-02-20 00:47:07 +01:00
parent dea6cfbc8f
commit 2c4d0e71a6
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
5 changed files with 50 additions and 34 deletions

View file

@ -1053,7 +1053,7 @@ fn str_from_utf8_range_count_too_high_for_start() {
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_repeat_small() {
fn str_repeat_small_stays_small() {
assert_evals_to!(
indoc!(r#"Str.repeat "Roc" 3"#),
RocStr::from("RocRocRoc"),
@ -1061,12 +1061,22 @@ fn str_repeat_small() {
);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_repeat_small_becomes_big() {
assert_evals_to!(
indoc!(r#"Str.repeat "less than 23 characters" 2"#),
RocStr::from("less than 23 charactersless than 23 characters"),
RocStr
);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_repeat_big() {
assert_evals_to!(
indoc!(r#"Str.repeat "more than 16 characters" 2"#),
RocStr::from("more than 16 charactersmore than 16 characters"),
indoc!(r#"Str.repeat "more than 23 characters now" 2"#),
RocStr::from("more than 23 characters nowmore than 23 characters now"),
RocStr
);
}
@ -1074,7 +1084,9 @@ fn str_repeat_big() {
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_repeat_empty_string() {
assert_evals_to!(indoc!(r#"Str.repeat "" 3"#), RocStr::from(""), RocStr);
let a = indoc!(r#"Str.repeat "" 3"#);
let b = RocStr::from("");
assert_evals_to!(a, b, RocStr);
}
#[test]