aboutsummaryrefslogtreecommitdiff
path: root/build2
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-06-05 16:14:52 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-06-05 16:14:52 +0300
commit952c3b41399247615fe3a3c6e5109199aacf73b5 (patch)
tree1b6bd246df528efd0ff4c04e3f8638597c569e69 /build2
parent2ea2446b8ff5c08469d16a0deb951b0962924cec (diff)
Add test id verification
Diffstat (limited to 'build2')
-rw-r--r--build2/test/script/parser.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx
index 250a61e..2ae0b05 100644
--- a/build2/test/script/parser.cxx
+++ b/build2/test/script/parser.cxx
@@ -1139,8 +1139,20 @@ namespace build2
// Otherwise, see if it is the id. Failed that we assume it is
// the summary until we see the next line.
//
- (l.find_first_of (" \t", i) >= j ? r.id : r.summary).
+ (l.find_first_of (" \t.", i) >= j ? r.id : r.summary).
assign (l, i, n);
+
+ // If this is an id then validate it.
+ //
+ if (!r.id.empty ())
+ {
+ for (char c: r.id)
+ {
+ if (!(alnum (c) || c == '_' || c == '-' || c == '+'))
+ fail (loc) << "illegal character '" << c
+ << "' in test id '" << r.id << "'";
+ }
+ }
}
}
else if (ln == 2)