Tue Mar 9 20:43:20 2021 UTC ()
tests/indent: demonstrate strange alignment for global variables


(rillig)
diff -r1.1029 -r1.1030 src/distrib/sets/lists/tests/mi
diff -r1.6 -r1.7 src/tests/usr.bin/indent/Makefile
diff -r0 -r1.1 src/tests/usr.bin/indent/indent_variables.0
diff -r0 -r1.1 src/tests/usr.bin/indent/indent_variables.0.pro
diff -r0 -r1.1 src/tests/usr.bin/indent/indent_variables.0.stdout

cvs diff -r1.1029 -r1.1030 src/distrib/sets/lists/tests/mi (expand / switch to unified diff)

--- src/distrib/sets/lists/tests/mi 2021/03/08 22:13:05 1.1029
+++ src/distrib/sets/lists/tests/mi 2021/03/09 20:43:19 1.1030
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: mi,v 1.1029 2021/03/08 22:13:05 rillig Exp $ 1# $NetBSD: mi,v 1.1030 2021/03/09 20:43:19 rillig Exp $
2# 2#
3# Note: don't delete entries from here - mark them as "obsolete" instead. 3# Note: don't delete entries from here - mark them as "obsolete" instead.
4# 4#
5./etc/mtree/set.tests tests-sys-root 5./etc/mtree/set.tests tests-sys-root
6./usr/libdata/debug/usr/tests tests-base-debug compattestdir 6./usr/libdata/debug/usr/tests tests-base-debug compattestdir
7./usr/libdata/debug/usr/tests/atf tests-atf-debug compattestfile,atf 7./usr/libdata/debug/usr/tests/atf tests-atf-debug compattestfile,atf
8./usr/libdata/debug/usr/tests/atf/atf-c tests-atf-debug compattestfile,atf 8./usr/libdata/debug/usr/tests/atf/atf-c tests-atf-debug compattestfile,atf
9./usr/libdata/debug/usr/tests/atf/atf-c++ tests-atf-debug compattestfile,atf 9./usr/libdata/debug/usr/tests/atf/atf-c++ tests-atf-debug compattestfile,atf
10./usr/libdata/debug/usr/tests/atf/atf-c++/detail tests-atf-debug compattestfile,atf 10./usr/libdata/debug/usr/tests/atf/atf-c++/detail tests-atf-debug compattestfile,atf
11./usr/libdata/debug/usr/tests/atf/atf-c/detail tests-atf-debug compattestfile,atf 11./usr/libdata/debug/usr/tests/atf/atf-c/detail tests-atf-debug compattestfile,atf
12./usr/libdata/debug/usr/tests/atf/atf-compile tests-obsolete obsolete 12./usr/libdata/debug/usr/tests/atf/atf-compile tests-obsolete obsolete
13./usr/libdata/debug/usr/tests/atf/atf-report tests-obsolete obsolete 13./usr/libdata/debug/usr/tests/atf/atf-report tests-obsolete obsolete
14./usr/libdata/debug/usr/tests/atf/atf-run tests-obsolete obsolete 14./usr/libdata/debug/usr/tests/atf/atf-run tests-obsolete obsolete
@@ -4717,26 +4717,29 @@ @@ -4717,26 +4717,29 @@
4717./usr/tests/usr.bin/indent/comments.0.stdout tests-usr.bin-tests compattestfile,atf 4717./usr/tests/usr.bin/indent/comments.0.stdout tests-usr.bin-tests compattestfile,atf
4718./usr/tests/usr.bin/indent/cs.0 tests-usr.bin-tests compattestfile,atf 4718./usr/tests/usr.bin/indent/cs.0 tests-usr.bin-tests compattestfile,atf
4719./usr/tests/usr.bin/indent/cs.0.pro tests-usr.bin-tests compattestfile,atf 4719./usr/tests/usr.bin/indent/cs.0.pro tests-usr.bin-tests compattestfile,atf
4720./usr/tests/usr.bin/indent/cs.0.stdout tests-usr.bin-tests compattestfile,atf 4720./usr/tests/usr.bin/indent/cs.0.stdout tests-usr.bin-tests compattestfile,atf
4721./usr/tests/usr.bin/indent/declarations.0 tests-usr.bin-tests compattestfile,atf 4721./usr/tests/usr.bin/indent/declarations.0 tests-usr.bin-tests compattestfile,atf
4722./usr/tests/usr.bin/indent/declarations.0.stdout tests-usr.bin-tests compattestfile,atf 4722./usr/tests/usr.bin/indent/declarations.0.stdout tests-usr.bin-tests compattestfile,atf
4723./usr/tests/usr.bin/indent/elsecomment.0 tests-usr.bin-tests compattestfile,atf 4723./usr/tests/usr.bin/indent/elsecomment.0 tests-usr.bin-tests compattestfile,atf
4724./usr/tests/usr.bin/indent/elsecomment.0.pro tests-usr.bin-tests compattestfile,atf 4724./usr/tests/usr.bin/indent/elsecomment.0.pro tests-usr.bin-tests compattestfile,atf
4725./usr/tests/usr.bin/indent/elsecomment.0.stdout tests-usr.bin-tests compattestfile,atf 4725./usr/tests/usr.bin/indent/elsecomment.0.stdout tests-usr.bin-tests compattestfile,atf
4726./usr/tests/usr.bin/indent/f_decls.0 tests-usr.bin-tests compattestfile,atf 4726./usr/tests/usr.bin/indent/f_decls.0 tests-usr.bin-tests compattestfile,atf
4727./usr/tests/usr.bin/indent/f_decls.0.stdout tests-usr.bin-tests compattestfile,atf 4727./usr/tests/usr.bin/indent/f_decls.0.stdout tests-usr.bin-tests compattestfile,atf
4728./usr/tests/usr.bin/indent/float.0 tests-usr.bin-tests compattestfile,atf 4728./usr/tests/usr.bin/indent/float.0 tests-usr.bin-tests compattestfile,atf
4729./usr/tests/usr.bin/indent/float.0.stdout tests-usr.bin-tests compattestfile,atf 4729./usr/tests/usr.bin/indent/float.0.stdout tests-usr.bin-tests compattestfile,atf
 4730./usr/tests/usr.bin/indent/indent_variables.0 tests-usr.bin-tests compattestfile,atf
 4731./usr/tests/usr.bin/indent/indent_variables.0.pro tests-usr.bin-tests compattestfile,atf
 4732./usr/tests/usr.bin/indent/indent_variables.0.stdout tests-usr.bin-tests compattestfile,atf
4730./usr/tests/usr.bin/indent/label.0 tests-usr.bin-tests compattestfile,atf 4733./usr/tests/usr.bin/indent/label.0 tests-usr.bin-tests compattestfile,atf
4731./usr/tests/usr.bin/indent/label.0.pro tests-usr.bin-tests compattestfile,atf 4734./usr/tests/usr.bin/indent/label.0.pro tests-usr.bin-tests compattestfile,atf
4732./usr/tests/usr.bin/indent/label.0.stdout tests-usr.bin-tests compattestfile,atf 4735./usr/tests/usr.bin/indent/label.0.stdout tests-usr.bin-tests compattestfile,atf
4733./usr/tests/usr.bin/indent/lineno.0 tests-usr.bin-tests compattestfile,atf 4736./usr/tests/usr.bin/indent/lineno.0 tests-usr.bin-tests compattestfile,atf
4734./usr/tests/usr.bin/indent/lineno.0.pro tests-usr.bin-tests compattestfile,atf 4737./usr/tests/usr.bin/indent/lineno.0.pro tests-usr.bin-tests compattestfile,atf
4735./usr/tests/usr.bin/indent/lineno.0.stdout tests-usr.bin-tests compattestfile,atf 4738./usr/tests/usr.bin/indent/lineno.0.stdout tests-usr.bin-tests compattestfile,atf
4736./usr/tests/usr.bin/indent/list_head.0 tests-usr.bin-tests compattestfile,atf 4739./usr/tests/usr.bin/indent/list_head.0 tests-usr.bin-tests compattestfile,atf
4737./usr/tests/usr.bin/indent/list_head.0.stdout tests-usr.bin-tests compattestfile,atf 4740./usr/tests/usr.bin/indent/list_head.0.stdout tests-usr.bin-tests compattestfile,atf
4738./usr/tests/usr.bin/indent/ncs.0 tests-usr.bin-tests compattestfile,atf 4741./usr/tests/usr.bin/indent/ncs.0 tests-usr.bin-tests compattestfile,atf
4739./usr/tests/usr.bin/indent/ncs.0.pro tests-usr.bin-tests compattestfile,atf 4742./usr/tests/usr.bin/indent/ncs.0.pro tests-usr.bin-tests compattestfile,atf
4740./usr/tests/usr.bin/indent/ncs.0.stdout tests-usr.bin-tests compattestfile,atf 4743./usr/tests/usr.bin/indent/ncs.0.stdout tests-usr.bin-tests compattestfile,atf
4741./usr/tests/usr.bin/indent/offsetof.0 tests-usr.bin-tests compattestfile,atf 4744./usr/tests/usr.bin/indent/offsetof.0 tests-usr.bin-tests compattestfile,atf
4742./usr/tests/usr.bin/indent/offsetof.0.stdout tests-usr.bin-tests compattestfile,atf 4745./usr/tests/usr.bin/indent/offsetof.0.stdout tests-usr.bin-tests compattestfile,atf

cvs diff -r1.6 -r1.7 src/tests/usr.bin/indent/Makefile (expand / switch to unified diff)

--- src/tests/usr.bin/indent/Makefile 2021/03/08 22:13:05 1.6
+++ src/tests/usr.bin/indent/Makefile 2021/03/09 20:43:20 1.7
@@ -1,39 +1,42 @@ @@ -1,39 +1,42 @@
1# $NetBSD: Makefile,v 1.6 2021/03/08 22:13:05 rillig Exp $ 1# $NetBSD: Makefile,v 1.7 2021/03/09 20:43:20 rillig Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
5TESTSDIR= ${TESTSBASE}/usr.bin/indent 5TESTSDIR= ${TESTSBASE}/usr.bin/indent
6TESTS_SH= t_indent 6TESTS_SH= t_indent
7 7
8FILESDIR= ${TESTSDIR} 8FILESDIR= ${TESTSDIR}
9FILES= binary.0 9FILES= binary.0
10FILES+= binary.0.stdout 10FILES+= binary.0.stdout
11FILES+= block.0 11FILES+= block.0
12FILES+= block.0.stdout 12FILES+= block.0.stdout
13FILES+= comment-line-end.0 13FILES+= comment-line-end.0
14FILES+= comment-line-end.0.stdout 14FILES+= comment-line-end.0.stdout
15FILES+= comments.0 15FILES+= comments.0
16FILES+= comments.0.pro 16FILES+= comments.0.pro
17FILES+= comments.0.stdout 17FILES+= comments.0.stdout
18FILES+= declarations.0 18FILES+= declarations.0
19FILES+= declarations.0.stdout 19FILES+= declarations.0.stdout
20FILES+= elsecomment.0 20FILES+= elsecomment.0
21FILES+= elsecomment.0.stdout 21FILES+= elsecomment.0.stdout
22FILES+= elsecomment.0.pro 22FILES+= elsecomment.0.pro
23FILES+= f_decls.0 23FILES+= f_decls.0
24FILES+= f_decls.0.stdout 24FILES+= f_decls.0.stdout
25FILES+= float.0 25FILES+= float.0
26FILES+= float.0.stdout 26FILES+= float.0.stdout
 27FILES+= indent_variables.0
 28FILES+= indent_variables.0.pro
 29FILES+= indent_variables.0.stdout
27FILES+= label.0 30FILES+= label.0
28FILES+= label.0.stdout 31FILES+= label.0.stdout
29FILES+= label.0.pro 32FILES+= label.0.pro
30FILES+= lineno.0 33FILES+= lineno.0
31FILES+= lineno.0.pro 34FILES+= lineno.0.pro
32FILES+= lineno.0.stdout 35FILES+= lineno.0.stdout
33FILES+= list_head.0 36FILES+= list_head.0
34FILES+= list_head.0.stdout 37FILES+= list_head.0.stdout
35FILES+= ncs.0 38FILES+= ncs.0
36FILES+= ncs.0.stdout 39FILES+= ncs.0.stdout
37FILES+= ncs.0.pro 40FILES+= ncs.0.pro
38FILES+= offsetof.0 41FILES+= offsetof.0
39FILES+= offsetof.0.stdout 42FILES+= offsetof.0.stdout
@@ -259,14 +262,73 @@ FILES+= cs.0.stdout @@ -259,14 +262,73 @@ FILES+= cs.0.stdout
259FILES+= cs.0.pro 262FILES+= cs.0.pro
260FILES+= struct.0 263FILES+= struct.0
261FILES+= struct.0.stdout 264FILES+= struct.0.stdout
262FILES+= surplusbad.0 265FILES+= surplusbad.0
263FILES+= surplusbad.0.stdout 266FILES+= surplusbad.0.stdout
264FILES+= surplusbad.0.pro 267FILES+= surplusbad.0.pro
265FILES+= types_from_file.0 268FILES+= types_from_file.0
266FILES+= types_from_file.0.stdout 269FILES+= types_from_file.0.stdout
267FILES+= types_from_file.0.list 270FILES+= types_from_file.0.list
268FILES+= types_from_file.0.pro 271FILES+= types_from_file.0.pro
269FILES+= wchar.0 272FILES+= wchar.0
270FILES+= wchar.0.stdout 273FILES+= wchar.0.stdout
271 274
 275add-test: .PHONY
 276 @set -eu; \
 277 test=${NAME:Q}; \
 278 [ "$$test" ] || { \
 279 echo "usage: ${MAKE} add-test NAME=<name>"; \
 280 exit; \
 281 }; \
 282 \
 283 if [ -f "$$test" ]; then \
 284 echo "error: test $$test already exists." 1>&2; \
 285 exit 1; \
 286 fi; \
 287 \
 288 echo "=> Adding test $$test"; \
 289 printf '%s\n' \
 290 '/* $$''NetBSD$$ */' \
 291 '/* $$''FreeBSD$$ */' \
 292 '' \
 293 '/*' \
 294 ' * TODO: Explain the purpose of the test.' \
 295 '*/' \
 296 '' \
 297 '// TODO: Add some code that passes.' \
 298 > "$$test"; \
 299 printf '%s\n' \
 300 '/* $$''NetBSD$$ */' \
 301 '/* $$''FreeBSD$$ */' \
 302 '' \
 303 '/*' \
 304 ' * TODO: Explain the command line options of the test.' \
 305 ' */' \
 306 '' \
 307 '/* TODO: Add some command line options */' \
 308 > "$$test.pro"; \
 309 cat < "$$test" > "$$test.stdout"; \
 310 cvs add "$$test" "$$test.pro" "$$test.stdout"; \
 311 printf '%s\n' \
 312 '/^FILES+=/i' \
 313 "FILES+= $$test" \
 314 "FILES+= $$test.pro" \
 315 "FILES+= $$test.stdout" \
 316 '.' 'w' 'q' \
 317 | ed Makefile; \
 318 ${MAKE} sync-mi
 319
 320# Note: only works for adding tests.
 321# To remove a test, the $$mi file must be edited manually.
 322sync-mi: .PHONY
 323 @set -eu; \
 324 cd "${MAKEFILE:tA:H}/../../.."; \
 325 mi="distrib/sets/lists/tests/mi"; \
 326 cvs update "$$mi"; \
 327 fmt="./usr/tests/usr.bin/indent/%s\ttests-usr.bin-tests\tcompattestfile,atf\n"; \
 328 cat "$$mi" > "$$mi.tmp"; \
 329 printf "$$fmt" ${FILES:M${NAME}*} >> "$$mi.tmp"; \
 330 distrib/sets/fmt-list "$$mi.tmp"; \
 331 mv "$$mi.tmp" "$$mi"; \
 332 cvs diff "$$mi" || true
 333
272.include <bsd.test.mk> 334.include <bsd.test.mk>

File Added: src/tests/usr.bin/indent/Attic/indent_variables.0
/* $NetBSD: indent_variables.0,v 1.1 2021/03/09 20:43:20 rillig Exp $ */
/* $FreeBSD$ */

/*-
 * Demonstrate how variable declarations are broken into several lines when
 * the line length limit is set quite low.
 */

struct s0 a,b;
struct s01 a,b;
struct s012 a,b;
struct s0123 a,b;
struct s01234 a,b;
struct s012345 a,b;
struct s0123456 a,b;
struct s01234567 a,b;
struct s012345678 a,b;
struct s0123456789 a,b;
struct s01234567890 a,b;
struct s012345678901 a,b;
struct s0123456789012 a,b;
struct s01234567890123 a,b;

File Added: src/tests/usr.bin/indent/Attic/indent_variables.0.pro
/* $NetBSD: indent_variables.0.pro,v 1.1 2021/03/09 20:43:20 rillig Exp $ */
/* $FreeBSD$ */

-l20
-di0

File Added: src/tests/usr.bin/indent/Attic/indent_variables.0.stdout
/* $NetBSD: indent_variables.0.stdout,v 1.1 2021/03/09 20:43:20 rillig Exp $ */
/* $FreeBSD$ */

/*-
 * Demonstrate how variable declarations are broken into several lines when
 * the line length limit is set quite low.
 */

struct s0 a,
   b;
struct s01 a,
    b;
struct s012 a,
     b;
struct s0123 a,
      b;
struct s01234 a,
       b;
struct s012345 a,
        b;
struct s0123456 a,
         b;
struct s01234567 a,
          b;
struct s012345678 a,
           b;
struct s0123456789 a,
            b;
struct s01234567890 a,
             b;
struct s012345678901 a,
              b;
struct s0123456789012 a,
               b;
struct s01234567890123 a,
                b;