From a51abe3beed52dec3425be3e535cc616b9fc37e3 Mon Sep 17 00:00:00 2001 From: Arthur Cohen Date: Wed, 25 Dec 2024 17:02:38 +0000 Subject: [PATCH] parser: Add testcases for multiline strings Regression checks for Rust-GCC#1399 gcc/testsuite/ChangeLog: * rust/compile/multiline-string.rs: New test. * rust/execute/torture/multiline-string.rs: New test. --- gcc/testsuite/rust/compile/multiline-string.rs | 14 ++++++++++++++ .../rust/execute/torture/multiline-string.rs | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 gcc/testsuite/rust/compile/multiline-string.rs create mode 100644 gcc/testsuite/rust/execute/torture/multiline-string.rs diff --git a/gcc/testsuite/rust/compile/multiline-string.rs b/gcc/testsuite/rust/compile/multiline-string.rs new file mode 100644 index 000000000000..fcd6fa812ed2 --- /dev/null +++ b/gcc/testsuite/rust/compile/multiline-string.rs @@ -0,0 +1,14 @@ +fn main() { + let _a = "gcc + + rs"; + + let _b = "rust + + c + gcc + + + + rs"; +} diff --git a/gcc/testsuite/rust/execute/torture/multiline-string.rs b/gcc/testsuite/rust/execute/torture/multiline-string.rs new file mode 100644 index 000000000000..2dba3fd44985 --- /dev/null +++ b/gcc/testsuite/rust/execute/torture/multiline-string.rs @@ -0,0 +1,13 @@ +// { dg-output "gcc\n\n\nrs" } + +extern "C" { + fn printf(fmt: *const i8, ...); +} + +fn main() { + let a = "gcc + +rs\0"; + + unsafe { printf("%s\n\0" as *const str as *const i8, a as *const str as *const i8); } +}