Index: tests/Makefile =================================================================== --- /dev/null +++ tests/Makefile @@ -0,0 +1,37 @@ +INDENT_OBJDIR!= ${MAKE} -C ${.CURDIR}/.. -V .OBJDIR +INDENT= ${INDENT_OBJDIR}/indent + +TESTS= comments declarations elsecomment float label list_head nsac \ + offsetof sac struct surplusbad types-from-file wchar + +all: run-tests .WAIT show-diffs + +.for T in $(TESTS) +run-tests: $(T).diff + +$(T).diff: $(T).run $(T).good $(INDENT) + -diff -u $(T).good $(T).run > $(T).diff + +$(T).run: $(INDENT) $(T).c + @cp $(T).pro .indent.pro 2>/dev/null && echo "cp $(T).pro .indent.pro" || : + $(INDENT) $(T).c $(T).run 2>&1 || echo FAILED >> $(T).run + @rm .indent.pro 2>/dev/null && echo 'rm .indent.pro' || : +.endfor + +show-diffs: + @echo '*** Test diffs ***' +.for T in $(TESTS) + @cat $(T).diff +.endfor + +clean: +.for T in $(TESTS) + rm -f $(T).run $(T).diff $(T).o $(T).plist +.endfor + +good: +.for T in $(TESTS) + cp $(T).run $(T).good +.endfor + +.PHONY: all run-tests show-diffs clean good \ No newline at end of file Index: tests/comments.c =================================================================== --- /dev/null +++ tests/comments.c @@ -0,0 +1,24 @@ +/* See r303597, r303598, r309219, and r309343 */ +void t(void) { + /* + * Old indent wrapped the URL near where this sentence ends. + * + * https://www.freebsd.org/cgi/man.cgi?query=indent&apropos=0&sektion=0&manpath=FreeBSD+12-current&arch=default&format=html + */ + + /* + * Old indent did not wrap to column 78 + * + * aaaaaa bbbbbb cccccc dddddd eeeeee ffffff ggggg hhhhh iiiii jjjj kk + */ + + /* + * Old indent unnecessarily removed the star comment continuation on the next line. + * + * *test* + */ + + /* r309219 Go through linked list, freeing from the malloced (t[-1]) address. */ + + /* r309343 */ +} Index: tests/comments.good =================================================================== --- /dev/null +++ tests/comments.good @@ -0,0 +1,31 @@ +/* See r303597, r303598, r309219, and r309343 */ +void +t(void) +{ + /* + * Old indent wrapped the URL near where this sentence ends. + * + * https://www.freebsd.org/cgi/man.cgi?query=indent&apropos=0&sektion=0&manpath=FreeBSD+12-current&arch=default&format=html + */ + + /* + * Old indent did not wrap to column 78 + * + * aaaaaa bbbbbb cccccc dddddd eeeeee ffffff ggggg hhhhh iiiii jjjj + * kk + */ + + /* + * Old indent unnecessarily removed the star comment continuation on + * the next line. + * + * *test* + */ + + /* + * r309219 Go through linked list, freeing from the malloced (t[-1]) + * address. + */ + + /* r309343 */ +} Index: tests/declarations.c =================================================================== --- /dev/null +++ tests/declarations.c @@ -0,0 +1,20 @@ +/* See r303570 */ +void t(void) { + int a, + b, + c; + int + *d, + *e, + *f; + int (*g)(), + (*h)(), + (*i)(); + int j, + k, + l; + int m + ,n + ,o + ; +} Index: tests/declarations.good =================================================================== --- /dev/null +++ tests/declarations.good @@ -0,0 +1,14 @@ +/* See r303570 */ +void +t(void) +{ + int a, b, c; + int + *d, *e, *f; + int (*g) (), (*h) (), (*i) (); + int j, k, l; + int m + ,n + ,o + ; +} Index: tests/elsecomment.c =================================================================== --- /dev/null +++ tests/elsecomment.c @@ -0,0 +1,17 @@ +/* See r303484 and r309342 */ +void t(void) { + if (0) { + + } /* Old indent would remove the following blank line */ + + /* + * test + */ + + if (1) + ; + else /* Old indent would get very confused here */ + { + + } +} Index: tests/elsecomment.good =================================================================== --- /dev/null +++ tests/elsecomment.good @@ -0,0 +1,21 @@ +/* See r303484 and r309342 */ +void +t(void) +{ + if (0) + { + + } /* Old indent would remove the following + * blank line */ + + /* + * test + */ + + if (1) + ; + else /* Old indent would get very confused here */ + { + + } +} Index: tests/elsecomment.pro =================================================================== --- /dev/null +++ tests/elsecomment.pro @@ -0,0 +1 @@ +-bl \ No newline at end of file Index: tests/float.c =================================================================== --- /dev/null +++ tests/float.c @@ -0,0 +1,5 @@ +/* See r303499 */ +void t(void) { + unsigned long x = 314UL; + float y = 3.14f; +} Index: tests/float.good =================================================================== --- /dev/null +++ tests/float.good @@ -0,0 +1,7 @@ +/* See r303499 */ +void +t(void) +{ + unsigned long x = 314UL; + float y = 3.14f; +} Index: tests/label.c =================================================================== --- /dev/null +++ tests/label.c @@ -0,0 +1,12 @@ +/* See r303489 */ +void t(void) { + switch (1) + { + case 1: /* test */ + case 2: /* test */ + } +CLEANUP: + ; +V: ; +U: ; +} Index: tests/label.good =================================================================== --- /dev/null +++ tests/label.good @@ -0,0 +1,13 @@ +/* See r303489 */ +void +t(void) +{ + switch (1) { + case 1: /* test */ + case 2: /* test */ + } +CLEANUP: + ; +V: ; +U: ; +} Index: tests/label.pro =================================================================== --- /dev/null +++ tests/label.pro @@ -0,0 +1 @@ +-nut \ No newline at end of file Index: tests/list_head.c =================================================================== --- /dev/null +++ tests/list_head.c @@ -0,0 +1,15 @@ +/* See r309380 */ +static int +do_execve(td, args, mac_p) + struct thread *td; + struct image_args *args; + struct mac *mac_p; +{ + +} + +static LIST_HEAD(, alq) ald_active; +static int ald_shuttingdown = 0; +struct thread *ald_thread; + + Index: tests/list_head.good =================================================================== --- /dev/null +++ tests/list_head.good @@ -0,0 +1,13 @@ +/* See r309380 */ +static int +do_execve(td, args, mac_p) + struct thread *td; + struct image_args *args; + struct mac *mac_p; +{ + +} + +static LIST_HEAD(, alq) ald_active; +static int ald_shuttingdown = 0; +struct thread *ald_thread; Index: tests/nsac.c =================================================================== --- /dev/null +++ tests/nsac.c @@ -0,0 +1,3 @@ +void t(void) { + int a = (double) 8; +} Index: tests/nsac.good =================================================================== --- /dev/null +++ tests/nsac.good @@ -0,0 +1,5 @@ +void +t(void) +{ + int a = (double)8; +} Index: tests/nsac.pro =================================================================== --- /dev/null +++ tests/nsac.pro @@ -0,0 +1 @@ +-nsac \ No newline at end of file Index: tests/offsetof.c =================================================================== --- /dev/null +++ tests/offsetof.c @@ -0,0 +1,4 @@ +/* See r303718 */ +void t(void) { + int ntable = malloc(offsetof(struct fdescenttbl, fdt_ofiles) + 1); +} Index: tests/offsetof.good =================================================================== --- /dev/null +++ tests/offsetof.good @@ -0,0 +1,6 @@ +/* See r303718 */ +void +t(void) +{ + int ntable = malloc(offsetof(struct fdescenttbl, fdt_ofiles) + 1); +} Index: tests/sac.c =================================================================== --- /dev/null +++ tests/sac.c @@ -0,0 +1,3 @@ +void t(void) { + int a = (double) 8; +} Index: tests/sac.good =================================================================== --- /dev/null +++ tests/sac.good @@ -0,0 +1,5 @@ +void +t(void) +{ + int a = (double) 8; +} Index: tests/sac.pro =================================================================== --- /dev/null +++ tests/sac.pro @@ -0,0 +1 @@ +-sac \ No newline at end of file Index: tests/struct.c =================================================================== --- /dev/null +++ tests/struct.c @@ -0,0 +1,12 @@ +/* See r303485 */ +void +t(void) +{ + static const struct { + int a; + int b; + } c[] = { + { D, E }, + { F, G } + }; +} Index: tests/struct.good =================================================================== --- /dev/null +++ tests/struct.good @@ -0,0 +1,12 @@ +/* See r303485 */ +void +t(void) +{ + static const struct { + int a; + int b; + } c[] = { + {D, E}, + {F, G} + }; +} Index: tests/surplusbad.c =================================================================== --- /dev/null +++ tests/surplusbad.c @@ -0,0 +1,8 @@ +/* See r303599 */ +#if defined(__i386__) +int a; +#elif defined(__amd64__) +int b; +#else +#error "Port me" +#endif Index: tests/surplusbad.good =================================================================== --- /dev/null +++ tests/surplusbad.good @@ -0,0 +1,8 @@ +/* See r303599 */ +#if defined(__i386__) +int a; +#elif defined(__amd64__) +int b; +#else +#error "Port me" +#endif Index: tests/surplusbad.pro =================================================================== --- /dev/null +++ tests/surplusbad.pro @@ -0,0 +1 @@ +-bad \ No newline at end of file Index: tests/types-from-file.c =================================================================== --- /dev/null +++ tests/types-from-file.c @@ -0,0 +1,2 @@ +/* See r303735 */ +void t(a *x, b *y, c *z); Index: tests/types-from-file.good =================================================================== --- /dev/null +++ tests/types-from-file.good @@ -0,0 +1,2 @@ +/* See r303735 */ +void t(a *x, b *y, c * z); Index: tests/types-from-file.list =================================================================== --- /dev/null +++ tests/types-from-file.list @@ -0,0 +1,2 @@ +b +a \ No newline at end of file Index: tests/types-from-file.pro =================================================================== --- /dev/null +++ tests/types-from-file.pro @@ -0,0 +1 @@ +-Utypes-from-file.list \ No newline at end of file Index: tests/wchar.c =================================================================== --- /dev/null +++ tests/wchar.c @@ -0,0 +1,5 @@ +/* See r309220 */ +#include + +wchar_t *x = L"test"; +wchar_t y = L't'; Index: tests/wchar.good =================================================================== --- /dev/null +++ tests/wchar.good @@ -0,0 +1,5 @@ +/* See r309220 */ +#include + +wchar_t *x = L"test"; +wchar_t y = L't';