diff options
-rw-r--r-- | build2/test/script/parser.cxx | 14 | ||||
-rw-r--r-- | doc/testscript.cli | 7 |
2 files changed, 17 insertions, 4 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) diff --git a/doc/testscript.cli b/doc/testscript.cli index 41f8111..4433375 100644 --- a/doc/testscript.cli +++ b/doc/testscript.cli @@ -273,9 +273,10 @@ The description lines precede the test command. They start with a colon The recommended format for \c{<id>} is \c{<keyword>-<keyword>...} with at least two keywords. The id is used in diagnostics, to name the test working directory, as well as to run individual tests. It can only contain -alphanumeric characters as well as underscores and minuses. The recommended -style for \c{<summary>} is that of the \c{git(1)} commit summary. The detailed -description is free-form. Here are some examples (\c{#} starts a comment): +alphanumeric characters as well as underscores, pluses, and minuses. The +recommended style for \c{<summary>} is that of the \c{git(1)} commit summary. +The detailed description is free-form. Here are some examples (\c{#} starts a +comment): \ # Only id. |