From 2f7ed335178c7fbe5d35e015774ca06486c69ce3 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 1 Aug 2011 16:41:20 -0700 Subject: [PATCH] Ignore whitespace in argument lists in compiletest Makes testing work with DEBUG=1 --- src/test/compiletest/compiletest.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/test/compiletest/compiletest.rs b/src/test/compiletest/compiletest.rs index 7209c1e0c875..0bc7f392442e 100644 --- a/src/test/compiletest/compiletest.rs +++ b/src/test/compiletest/compiletest.rs @@ -533,8 +533,27 @@ mod runtest { } fn split_maybe_args(argstr: &option::t[str]) -> vec[str] { + fn rm_whitespace(v: vec[str]) -> vec[str] { + fn flt(s: &str) -> option::t[str] { + if !is_whitespace(s) { + option::some(s) + } else { + option::none + } + } + + // FIXME: This should be in std + fn is_whitespace(s: str) -> bool { + for c: u8 in s { + if c != (' ' as u8) { ret false; } + } + ret true; + } + vec::filter_map(flt, v) + } + alt argstr { - option::some(s) { str::split(s, ' ' as u8) } + option::some(s) { rm_whitespace(str::split(s, ' ' as u8)) } option::none. { [] } } }