From 952c3b41399247615fe3a3c6e5109199aacf73b5 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 5 Jun 2019 16:14:52 +0300 Subject: Add test id verification --- build2/test/script/parser.cxx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'build2') 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) -- cgit v1.1