Add Str.repeat test for big strings

This commit is contained in:
Kofi Gumbs 2021-09-29 21:54:06 -04:00
parent b32a42f05a
commit 0cdafa1623

View file

@ -951,7 +951,7 @@ fn str_from_utf8_range_count_too_high_for_start() {
} }
#[test] #[test]
fn str_repeat() { fn str_repeat_small() {
assert_evals_to!( assert_evals_to!(
indoc!(r#"Str.repeat "Roc" 3"#), indoc!(r#"Str.repeat "Roc" 3"#),
RocStr::from("RocRocRoc"), RocStr::from("RocRocRoc"),
@ -960,19 +960,20 @@ fn str_repeat() {
} }
#[test] #[test]
fn str_repeat_empty_string() { fn str_repeat_big() {
assert_evals_to!( assert_evals_to!(
indoc!(r#"Str.repeat "" 3"#), indoc!(r#"Str.repeat "more than 16 characters" 2"#),
RocStr::from(""), RocStr::from("more than 16 charactersmore than 16 characters"),
RocStr RocStr
); );
} }
#[test] #[test]
fn str_repeat_zero_times() { fn str_repeat_empty_string() {
assert_evals_to!( assert_evals_to!(indoc!(r#"Str.repeat "" 3"#), RocStr::from(""), RocStr);
indoc!(r#"Str.repeat "Roc" 0"#), }
RocStr::from(""),
RocStr #[test]
); fn str_repeat_zero_times() {
assert_evals_to!(indoc!(r#"Str.repeat "Roc" 0"#), RocStr::from(""), RocStr);
} }