From: Ralf Wildenhues Date: Wed, 12 Nov 2008 22:54:01 +0000 (+0100) Subject: Wrap keywords in `testsuite --list' output. X-Git-Tag: v2.63b~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b1851ea3a819b82f340854e511eb89da23c20e7;p=thirdparty%2Fautoconf.git 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 --- diff --git a/ChangeLog b/ChangeLog index 488d38216..2a057487e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-11-12 Ralf Wildenhues + 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 diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index a4eb86db2..e497c02f1 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -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 diff --git a/tests/autotest.at b/tests/autotest.at index 4361d0755..d674c81a2 100644 --- a/tests/autotest.at +++ b/tests/autotest.at @@ -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 ## ## ----------------------- ##