Merge pull request #2071 from rtfeldman/refcount-mono-ir

Start generating refcounting code as mono IR
This commit is contained in:
Brian Carroll 2021-12-01 12:59:16 +00:00 committed by GitHub
commit a3827d6636
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 726 additions and 209 deletions

View file

@ -865,8 +865,8 @@ fn str_starts_with_false_small_str() {
#[test]
fn str_repeat_small() {
assert_evals_to!(
indoc!(r#"Str.repeat "Roc" 3"#),
RocStr::from("RocRocRoc"),
indoc!(r#"Str.repeat "Roc" 2"#),
RocStr::from("RocRoc"),
RocStr
);
}
@ -903,8 +903,8 @@ fn str_trim_small_blank_string() {
#[test]
fn str_trim_small_to_small() {
assert_evals_to!(
indoc!(r#"Str.trim " hello world ""#),
RocStr::from("hello world"),
indoc!(r#"Str.trim " hello ""#),
RocStr::from("hello"),
RocStr
);
}
@ -921,8 +921,8 @@ fn str_trim_large_to_large_unique() {
#[test]
fn str_trim_large_to_small_unique() {
assert_evals_to!(
indoc!(r#"Str.trim (Str.concat " " "hello world ")"#),
RocStr::from("hello world"),
indoc!(r#"Str.trim (Str.concat " " "hello ")"#),
RocStr::from("hello"),
RocStr
);
}
@ -952,15 +952,12 @@ fn str_trim_large_to_small_shared() {
indoc!(
r#"
original : Str
original = " hello world "
original = " hello "
{ trimmed: Str.trim original, original: original }
"#
),
(
RocStr::from(" hello world "),
RocStr::from("hello world"),
),
(RocStr::from(" hello "), RocStr::from("hello"),),
(RocStr, RocStr)
);
}
@ -971,12 +968,12 @@ fn str_trim_small_to_small_shared() {
indoc!(
r#"
original : Str
original = " hello world "
original = " hello "
{ trimmed: Str.trim original, original: original }
"#
),
(RocStr::from(" hello world "), RocStr::from("hello world"),),
(RocStr::from(" hello "), RocStr::from("hello"),),
(RocStr, RocStr)
);
}
@ -989,8 +986,8 @@ fn str_trim_left_small_blank_string() {
#[test]
fn str_trim_left_small_to_small() {
assert_evals_to!(
indoc!(r#"Str.trimLeft " hello world ""#),
RocStr::from("hello world "),
indoc!(r#"Str.trimLeft " hello ""#),
RocStr::from("hello "),
RocStr
);
}
@ -1007,8 +1004,8 @@ fn str_trim_left_large_to_large_unique() {
#[test]
fn str_trim_left_large_to_small_unique() {
assert_evals_to!(
indoc!(r#"Str.trimLeft (Str.concat " " "hello world ")"#),
RocStr::from("hello world "),
indoc!(r#"Str.trimLeft (Str.concat " " "hello ")"#),
RocStr::from("hello "),
RocStr
);
}
@ -1021,8 +1018,8 @@ fn str_trim_right_small_blank_string() {
#[test]
fn str_trim_right_small_to_small() {
assert_evals_to!(
indoc!(r#"Str.trimRight " hello world ""#),
RocStr::from(" hello world"),
indoc!(r#"Str.trimRight " hello ""#),
RocStr::from(" hello"),
RocStr
);
}
@ -1039,8 +1036,8 @@ fn str_trim_right_large_to_large_unique() {
#[test]
fn str_trim_right_large_to_small_unique() {
assert_evals_to!(
indoc!(r#"Str.trimRight (Str.concat " hello world" " ")"#),
RocStr::from(" hello world"),
indoc!(r#"Str.trimRight (Str.concat " hello" " ")"#),
RocStr::from(" hello"),
RocStr
);
}
@ -1070,15 +1067,12 @@ fn str_trim_right_large_to_small_shared() {
indoc!(
r#"
original : Str
original = " hello world "
original = " hello "
{ trimmed: Str.trimRight original, original: original }
"#
),
(
RocStr::from(" hello world "),
RocStr::from(" hello world"),
),
(RocStr::from(" hello "), RocStr::from(" hello"),),
(RocStr, RocStr)
);
}
@ -1089,12 +1083,12 @@ fn str_trim_right_small_to_small_shared() {
indoc!(
r#"
original : Str
original = " hello world "
original = " hello "
{ trimmed: Str.trimRight original, original: original }
"#
),
(RocStr::from(" hello world "), RocStr::from(" hello world"),),
(RocStr::from(" hello "), RocStr::from(" hello"),),
(RocStr, RocStr)
);
}