add test for str concat on non-unique first argument

This commit is contained in:
Folkert 2023-01-08 22:00:57 +01:00
parent 8a622a310d
commit 7b8b2a40f6
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -41,6 +41,7 @@ fn valgrind_test_linux(source: &str) {
for line in source.lines() {
app_module_source.push_str(" ");
app_module_source.push_str(line);
app_module_source.push('\n');
}
let temp_dir = tempfile::tempdir().unwrap();
@ -68,6 +69,12 @@ fn valgrind_test_linux(source: &str) {
run_with_valgrind(&binary_path);
}
Err(roc_cli::build::BuildFileError::LoadingProblem(
roc_load::LoadingProblem::FormattedReport(report),
)) => {
eprintln!("{}", report);
panic!("");
}
Err(e) => panic!("{:?}", e),
}
@ -178,3 +185,21 @@ fn split_not_present() {
"#
));
}
#[test]
fn str_concat_first_argument_not_unique() {
valgrind_test(indoc!(
r#"
(
str1 = Str.reserve "" 48
str2 = "a"
out = Str.concat str1 str2
if Bool.false then
out
else
str1
)
"#
));
}