about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-09-18 18:26:12 -0700
committerMichael Howell <michael@notriddle.com>2023-10-08 20:17:53 -0700
commit957c5db6be09f8def3f7a8297577a6d42e02f7c0 (patch)
tree2035681c1349e8b70fe6a8f258dab99742b81050
parent28ee5da4b7595465633e5852e0d5d1632fec02ae (diff)
downloadrust-957c5db6be09f8def3f7a8297577a6d42e02f7c0.tar.gz
rust-957c5db6be09f8def3f7a8297577a6d42e02f7c0.zip
compiletest: add a way to specify params with spaces
This use single quotes, because those aren't used in params,
while double quotes are and would be tougher to parse.
-rw-r--r--src/tools/compiletest/src/header.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 269d9384376..948439d6e79 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -322,7 +322,15 @@ impl TestProps {
                 );
 
                 if let Some(flags) = config.parse_name_value_directive(ln, COMPILE_FLAGS) {
-                    self.compile_flags.extend(flags.split_whitespace().map(|s| s.to_owned()));
+                    self.compile_flags.extend(
+                        flags
+                            .split("'")
+                            .enumerate()
+                            .flat_map(|(i, f)| {
+                                if i % 2 == 1 { vec![f] } else { f.split_whitespace().collect() }
+                            })
+                            .map(|s| s.to_owned()),
+                    );
                 }
                 if config.parse_name_value_directive(ln, INCORRECT_COMPILER_FLAGS).is_some() {
                     panic!("`compiler-flags` directive should be spelled `compile-flags`");