From 957c5db6be09f8def3f7a8297577a6d42e02f7c0 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 18 Sep 2023 18:26:12 -0700 Subject: [PATCH] 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. --- src/tools/compiletest/src/header.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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`");