]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Wrap keywords in `testsuite --list' output.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 12 Nov 2008 22:54:01 +0000 (23:54 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 12 Nov 2008 22:54:01 +0000 (23:54 +0100)
* 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>
ChangeLog
lib/autotest/general.m4
tests/autotest.at

index 488d3821682beb6048e1f68438cfb649bf1d4755..2a057487e9e80fb2b6ac6bc31eda47a109550833 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index a4eb86db2cf2f2d4bd1047f28562f0bacdd22929..e497c02f13cd0f9c357a957e76ccdec83ef104b7 100644 (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
index 4361d07555583d1fdef8440e4b4d7d325ac9b40d..d674c81a22e0f277071a7f5e7d500eef66479e98 100644 (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 ##
 ## ----------------------- ##