Wrap keywords in `testsuite --list' output.

* lib/autotest/general.m4 (AT_INIT): Rewrite --list awk script,
avoid lint warnings from gawk, wrap keyword lists to stay below
80 characters per line if possible.
* tests/autotest.at (Keyword wrapping): New test.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
This commit is contained in:
Ralf Wildenhues 2008-11-12 23:54:01 +01:00
parent 2e55333561
commit 1b1851ea3a
3 changed files with 57 additions and 3 deletions

View File

@ -1,5 +1,11 @@
2008-11-12 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Wrap keywords in `testsuite --list' output.
* lib/autotest/general.m4 (AT_INIT): Rewrite --list awk script,
avoid lint warnings from gawk, wrap keyword lists to stay below
80 characters per line if possible.
* tests/autotest.at (Keyword wrapping): New test.
* tests/local.at (AT_COPYRIGHT): Bump copyright years.
* doc/autoconf.texi (Conditional constructs, Macro Names): Fix

View File

@ -703,13 +703,33 @@ _ATEOF
AS_ECHO(["$at_groups$as_nl$at_help_all"]) |
awk 'BEGIN { FS = ";" }
NR == 1 {
for (n = split($ 0, a, " "); n; n--) selected[[a[n]]] = 1
for (n = split ($ 0, a, " "); n; n--)
selected[[a[n]]] = 1
next
}
{
NF > 0 {
if (selected[[$ 1]]) {
printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3
if ($ 4) printf " %s\n", $ 4
if ($ 4) {
lmax = 79
indent = " "
line = indent
len = length (line)
n = split ($ 4, a, " ")
for (i = 1; i <= n; i++) {
l = length (a[[i]]) + 1
if (i > 1 && len + l > lmax) {
print line
line = indent " " a[[i]]
len = length (line)
} else {
line = line " " a[[i]]
len += l
}
}
if (n)
print line
}
}
}' || at_write_fail=1
exit $at_write_fail

View File

@ -781,6 +781,34 @@ AT_CHECK_KEYS([--list -k none -k first], [none|first], [2], [second|both], [0])
AT_CLEANUP
## ----------------- ##
## Keyword wrapping. ##
## ----------------- ##
AT_SETUP([Keyword wrapping])
AT_CHECK_AT_PREP([k],
[[AT_INIT
AT_SETUP([test])
AT_KEYWORDS([a1 b1 c1 d1 e1 f1 g1 h1 i1 j1 k1 l1 m1 n1 o1 p1 q1 r1 s1 t1])
AT_KEYWORDS([u1 v1 w1 x1 y1 z1])
AT_KEYWORDS([a b c d e f g h i j k l m n o p q r s t u v w x y z])
AT_CLEANUP
AT_SETUP([test with long keywords])
AT_KEYWORDS(
[this-is-a-long-keyword-that-cannot-be-wrapped-so-we-exceed-the-length-limit-here])
# surrounded by short ones
AT_KEYWORDS([s])
AT_KEYWORDS(
[another-very-long-keyword-that-hits-the-line-length-limit-bla-bla-bla-bla])
AT_KEYWORDS([t])
AT_CLEANUP
]])
AT_CHECK_KEYS([-l], [.{80}], [1], [.{87}], [0])
AT_CLEANUP
## ----------------------- ##
## parallel test execution ##
## ----------------------- ##