aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/indent/tests
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/indent/tests')
-rw-r--r--usr.bin/indent/tests/Makefile54
-rw-r--r--usr.bin/indent/tests/Makefile.depend10
-rw-r--r--usr.bin/indent/tests/binary.09
-rw-r--r--usr.bin/indent/tests/binary.0.stdout11
-rw-r--r--usr.bin/indent/tests/comments.051
-rw-r--r--usr.bin/indent/tests/comments.0.pro1
-rw-r--r--usr.bin/indent/tests/comments.0.stdout59
-rw-r--r--usr.bin/indent/tests/cs.03
-rw-r--r--usr.bin/indent/tests/cs.0.pro1
-rw-r--r--usr.bin/indent/tests/cs.0.stdout5
-rw-r--r--usr.bin/indent/tests/declarations.078
-rw-r--r--usr.bin/indent/tests/declarations.0.stdout72
-rw-r--r--usr.bin/indent/tests/elsecomment.041
-rw-r--r--usr.bin/indent/tests/elsecomment.0.pro1
-rw-r--r--usr.bin/indent/tests/elsecomment.0.stdout46
-rw-r--r--usr.bin/indent/tests/f_decls.028
-rw-r--r--usr.bin/indent/tests/f_decls.0.stdout31
-rw-r--r--usr.bin/indent/tests/float.07
-rw-r--r--usr.bin/indent/tests/float.0.stdout9
-rwxr-xr-xusr.bin/indent/tests/functional_test.sh82
-rw-r--r--usr.bin/indent/tests/label.012
-rw-r--r--usr.bin/indent/tests/label.0.pro1
-rw-r--r--usr.bin/indent/tests/label.0.stdout13
-rw-r--r--usr.bin/indent/tests/list_head.015
-rw-r--r--usr.bin/indent/tests/list_head.0.stdout13
-rw-r--r--usr.bin/indent/tests/ncs.03
-rw-r--r--usr.bin/indent/tests/ncs.0.pro1
-rw-r--r--usr.bin/indent/tests/ncs.0.stdout5
-rw-r--r--usr.bin/indent/tests/offsetof.04
-rw-r--r--usr.bin/indent/tests/offsetof.0.stdout6
-rw-r--r--usr.bin/indent/tests/parens.026
-rw-r--r--usr.bin/indent/tests/parens.0.pro1
-rw-r--r--usr.bin/indent/tests/parens.0.stdout26
-rw-r--r--usr.bin/indent/tests/pcs.06
-rw-r--r--usr.bin/indent/tests/pcs.0.pro1
-rw-r--r--usr.bin/indent/tests/pcs.0.stdout8
-rw-r--r--usr.bin/indent/tests/ps.04
-rw-r--r--usr.bin/indent/tests/ps.0.pro1
-rw-r--r--usr.bin/indent/tests/ps.0.stdout8
-rw-r--r--usr.bin/indent/tests/struct.020
-rw-r--r--usr.bin/indent/tests/struct.0.stdout22
-rw-r--r--usr.bin/indent/tests/surplusbad.08
-rw-r--r--usr.bin/indent/tests/surplusbad.0.pro1
-rw-r--r--usr.bin/indent/tests/surplusbad.0.stdout8
-rw-r--r--usr.bin/indent/tests/types_from_file.02
-rw-r--r--usr.bin/indent/tests/types_from_file.0.list2
-rw-r--r--usr.bin/indent/tests/types_from_file.0.pro1
-rw-r--r--usr.bin/indent/tests/types_from_file.0.stdout2
-rw-r--r--usr.bin/indent/tests/wchar.05
-rw-r--r--usr.bin/indent/tests/wchar.0.stdout5
50 files changed, 829 insertions, 0 deletions
diff --git a/usr.bin/indent/tests/Makefile b/usr.bin/indent/tests/Makefile
new file mode 100644
index 000000000000..4e84917f8a40
--- /dev/null
+++ b/usr.bin/indent/tests/Makefile
@@ -0,0 +1,54 @@
+PACKAGE= tests
+
+${PACKAGE}FILES+= binary.0
+${PACKAGE}FILES+= binary.0.stdout
+${PACKAGE}FILES+= comments.0
+${PACKAGE}FILES+= comments.0.stdout
+${PACKAGE}FILES+= declarations.0
+${PACKAGE}FILES+= declarations.0.stdout
+${PACKAGE}FILES+= elsecomment.0
+${PACKAGE}FILES+= elsecomment.0.stdout
+${PACKAGE}FILES+= elsecomment.0.pro
+${PACKAGE}FILES+= f_decls.0
+${PACKAGE}FILES+= f_decls.0.stdout
+${PACKAGE}FILES+= float.0
+${PACKAGE}FILES+= float.0.stdout
+${PACKAGE}FILES+= label.0
+${PACKAGE}FILES+= label.0.stdout
+${PACKAGE}FILES+= label.0.pro
+${PACKAGE}FILES+= list_head.0
+${PACKAGE}FILES+= list_head.0.stdout
+${PACKAGE}FILES+= ncs.0
+${PACKAGE}FILES+= ncs.0.stdout
+${PACKAGE}FILES+= ncs.0.pro
+${PACKAGE}FILES+= offsetof.0
+${PACKAGE}FILES+= offsetof.0.stdout
+${PACKAGE}FILES+= parens.0
+${PACKAGE}FILES+= parens.0.stdout
+${PACKAGE}FILES+= parens.0.pro
+${PACKAGE}FILES+= pcs.0
+${PACKAGE}FILES+= pcs.0.stdout
+${PACKAGE}FILES+= pcs.0.pro
+${PACKAGE}FILES+= cs.0
+${PACKAGE}FILES+= cs.0.stdout
+${PACKAGE}FILES+= cs.0.pro
+${PACKAGE}FILES+= struct.0
+${PACKAGE}FILES+= struct.0.stdout
+${PACKAGE}FILES+= surplusbad.0
+${PACKAGE}FILES+= surplusbad.0.stdout
+${PACKAGE}FILES+= surplusbad.0.pro
+${PACKAGE}FILES+= types_from_file.0
+${PACKAGE}FILES+= types_from_file.0.stdout
+${PACKAGE}FILES+= types_from_file.0.list
+${PACKAGE}FILES+= types_from_file.0.pro
+${PACKAGE}FILES+= wchar.0
+${PACKAGE}FILES+= wchar.0.stdout
+${PACKAGE}FILES+= ps.0
+${PACKAGE}FILES+= ps.0.stdout
+${PACKAGE}FILES+= ps.0.pro
+
+ATF_TESTS_SH+= functional_test
+
+BINDIR= ${TESTSDIR}
+
+.include <bsd.test.mk>
diff --git a/usr.bin/indent/tests/Makefile.depend b/usr.bin/indent/tests/Makefile.depend
new file mode 100644
index 000000000000..11aba52f82cf
--- /dev/null
+++ b/usr.bin/indent/tests/Makefile.depend
@@ -0,0 +1,10 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/indent/tests/binary.0 b/usr.bin/indent/tests/binary.0
new file mode 100644
index 000000000000..0c5ebf7e8f89
--- /dev/null
+++ b/usr.bin/indent/tests/binary.0
@@ -0,0 +1,9 @@
+#define b00101010 -1
+void t(void) {
+ unsigned a[] = {0b00101010, 0x00005678, 02, 17U};
+ float x[] = {.7f, 0.7f};
+ unsigned long ul[] = {0b00001111UL, 0x01010101UL, 02UL, 17UL};
+
+ if (0 b00101010)
+ return;
+}
diff --git a/usr.bin/indent/tests/binary.0.stdout b/usr.bin/indent/tests/binary.0.stdout
new file mode 100644
index 000000000000..6118ac505550
--- /dev/null
+++ b/usr.bin/indent/tests/binary.0.stdout
@@ -0,0 +1,11 @@
+#define b00101010 -1
+void
+t(void)
+{
+ unsigned a[] = {0b00101010, 0x00005678, 02, 17U};
+ float x[] = {.7f, 0.7f};
+ unsigned long ul[] = {0b00001111UL, 0x01010101UL, 02UL, 17UL};
+
+ if (0 b00101010)
+ return;
+}
diff --git a/usr.bin/indent/tests/comments.0 b/usr.bin/indent/tests/comments.0
new file mode 100644
index 000000000000..6c40b9acfacb
--- /dev/null
+++ b/usr.bin/indent/tests/comments.0
@@ -0,0 +1,51 @@
+typedef enum x {
+ aaaaaaaaaaaaaaaaaaaaaa = 1 << 0, /* test a */
+ bbbbbbbbbbbbbbbbb = 1 << 1, /* test b */
+ cccccccccccccc = 1 << 1, /* test c */
+ dddddddddddddddddddddddddddddd = 1 << 2 /* test d */
+} x;
+
+/* See r303597, r303598, r309219, and r309343 */
+void t(void) {
+ /*
+ * Old indent wrapped the URL near where this sentence ends.
+ *
+ * https://man.freebsd.org/cgi/man.cgi?query=indent&apropos=0&sektion=0&manpath=freebsd-current&arch=default&format=html&x
+ */
+
+ /*
+ * 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 */
+}
+
+int c(void)
+{
+ if (1) { /*- a christmas tree *
+ ***
+ ***** */
+ /*- another one *
+ ***
+ ***** */
+ 7;
+ }
+
+ if (1) /*- a christmas tree *
+ ***
+ ***** */
+ /*- another one *
+ ***
+ ***** */
+ 1;
+}
diff --git a/usr.bin/indent/tests/comments.0.pro b/usr.bin/indent/tests/comments.0.pro
new file mode 100644
index 000000000000..ce818772931d
--- /dev/null
+++ b/usr.bin/indent/tests/comments.0.pro
@@ -0,0 +1 @@
+-bbb
diff --git a/usr.bin/indent/tests/comments.0.stdout b/usr.bin/indent/tests/comments.0.stdout
new file mode 100644
index 000000000000..bc3f7ace6b9b
--- /dev/null
+++ b/usr.bin/indent/tests/comments.0.stdout
@@ -0,0 +1,59 @@
+typedef enum x {
+ aaaaaaaaaaaaaaaaaaaaaa = 1 << 0, /* test a */
+ bbbbbbbbbbbbbbbbb = 1 << 1, /* test b */
+ cccccccccccccc = 1 << 1, /* test c */
+ dddddddddddddddddddddddddddddd = 1 << 2 /* test d */
+} x;
+
+/* See r303597, r303598, r309219, and r309343 */
+void
+t(void)
+{
+ /*
+ * Old indent wrapped the URL near where this sentence ends.
+ *
+ * https://man.freebsd.org/cgi/man.cgi?query=indent&apropos=0&sektion=0&manpath=freebsd-current&arch=default&format=html&x
+ */
+
+ /*
+ * 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 */
+}
+
+int
+c(void)
+{
+ if (1) { /*- a christmas tree *
+ ***
+ ***** */
+ /*- another one *
+ ***
+ ***** */
+ 7;
+ }
+
+ if (1) /*- a christmas tree *
+ ***
+ ***** */
+ /*- another one *
+ ***
+ ***** */
+ 1;
+}
diff --git a/usr.bin/indent/tests/cs.0 b/usr.bin/indent/tests/cs.0
new file mode 100644
index 000000000000..129feeeeae4b
--- /dev/null
+++ b/usr.bin/indent/tests/cs.0
@@ -0,0 +1,3 @@
+void t(void) {
+ int a = (double) 8;
+}
diff --git a/usr.bin/indent/tests/cs.0.pro b/usr.bin/indent/tests/cs.0.pro
new file mode 100644
index 000000000000..b0d3b81a79c5
--- /dev/null
+++ b/usr.bin/indent/tests/cs.0.pro
@@ -0,0 +1 @@
+-cs
diff --git a/usr.bin/indent/tests/cs.0.stdout b/usr.bin/indent/tests/cs.0.stdout
new file mode 100644
index 000000000000..177882470c02
--- /dev/null
+++ b/usr.bin/indent/tests/cs.0.stdout
@@ -0,0 +1,5 @@
+void
+t(void)
+{
+ int a = (double) 8;
+}
diff --git a/usr.bin/indent/tests/declarations.0 b/usr.bin/indent/tests/declarations.0
new file mode 100644
index 000000000000..706352ee2e37
--- /dev/null
+++ b/usr.bin/indent/tests/declarations.0
@@ -0,0 +1,78 @@
+/* See r303570 */
+
+typedef void (*voidptr) (int *);
+
+static const struct
+{
+ double x;
+ double y, z;
+} n[m + 1] =
+{
+ {
+ .0,
+ .9,
+ 5
+ }
+};
+
+typedef struct Complex
+{
+ double x;
+ double y;
+} Complex;
+
+void
+t1 (char *a, int b,
+ void (*fn)(void))
+{}
+
+void t2 (char *x, int y)
+{
+ int a,
+ b,
+ c;
+ int
+ *d,
+ *e,
+ *f;
+ int (*g)(),
+ (*h)(),
+ (*i)();
+ int j,
+ k,
+ l;
+ int m
+ ,n
+ ,o
+ ;
+ int chars[ /* push the comma beyond column 74 .... */ ], x;
+}
+
+const int int_minimum_size =
+MAXALIGN(offsetof(int, test)) + MAXIMUM_ALIGNOF;
+
+int *int_create(void)
+{
+
+}
+
+static
+_attribute_printf(1, 2)
+void
+print_error(const char *fmt,...)
+{
+
+}
+
+static LIST_HEAD(, alq) ald_active;
+static int ald_shutingdown = 0;
+struct thread *ald_thread;
+
+static int
+do_execve(td, args, mac_p)
+ struct thread *td;
+ struct image_args *args;
+ struct mac *mac_p;
+{
+
+}
diff --git a/usr.bin/indent/tests/declarations.0.stdout b/usr.bin/indent/tests/declarations.0.stdout
new file mode 100644
index 000000000000..f807c559c6ea
--- /dev/null
+++ b/usr.bin/indent/tests/declarations.0.stdout
@@ -0,0 +1,72 @@
+/* See r303570 */
+
+typedef void (*voidptr) (int *);
+
+static const struct {
+ double x;
+ double y, z;
+} n[m + 1] =
+{
+ {
+ .0,
+ .9,
+ 5
+ }
+};
+
+typedef struct Complex {
+ double x;
+ double y;
+} Complex;
+
+void
+t1(char *a, int b,
+ void (*fn) (void))
+{
+}
+
+void
+t2(char *x, int y)
+{
+ int a, b, c;
+ int
+ *d, *e, *f;
+ int (*g) (), (*h) (), (*i) ();
+ int j, k, l;
+ int m
+ ,n
+ ,o
+ ;
+ int chars[ /* push the comma beyond column 74 .... */ ],
+ x;
+}
+
+const int int_minimum_size =
+MAXALIGN(offsetof(int, test)) + MAXIMUM_ALIGNOF;
+
+int *
+int_create(void)
+{
+
+}
+
+static
+_attribute_printf(1, 2)
+void
+print_error(const char *fmt,...)
+{
+
+}
+
+static LIST_HEAD(, alq) ald_active;
+static int ald_shutingdown = 0;
+struct thread *ald_thread;
+
+static int
+do_execve(td, args, mac_p)
+ struct thread *td;
+ struct image_args *args;
+ struct mac *mac_p;
+{
+
+}
diff --git a/usr.bin/indent/tests/elsecomment.0 b/usr.bin/indent/tests/elsecomment.0
new file mode 100644
index 000000000000..f8aa05c77d82
--- /dev/null
+++ b/usr.bin/indent/tests/elsecomment.0
@@ -0,0 +1,41 @@
+/* See r303484 and r309342 */
+void t(void) {
+ /* The two if statements below excercise two different code paths. */
+
+ if (1) /* a */ int a; else /* b */ int b;
+
+ if (1) /* a */
+ int a;
+ else /* b */
+ int b;
+
+ if (1) {
+
+ }
+
+
+
+ /* Old indent would remove the 3 blank lines above, awaiting "else". */
+
+ if (1) {
+ int a;
+ }
+
+
+ else if (0) {
+ int b;
+ }
+ /* test */
+ else
+ ;
+
+ if (1)
+ ;
+ else /* Old indent would get very confused here */
+ /* We also mustn't assume that there's only one comment */
+ /* before the left brace. */
+ {
+
+
+ }
+}
diff --git a/usr.bin/indent/tests/elsecomment.0.pro b/usr.bin/indent/tests/elsecomment.0.pro
new file mode 100644
index 000000000000..84cf83a1ea27
--- /dev/null
+++ b/usr.bin/indent/tests/elsecomment.0.pro
@@ -0,0 +1 @@
+-bl
diff --git a/usr.bin/indent/tests/elsecomment.0.stdout b/usr.bin/indent/tests/elsecomment.0.stdout
new file mode 100644
index 000000000000..349f168d7e0a
--- /dev/null
+++ b/usr.bin/indent/tests/elsecomment.0.stdout
@@ -0,0 +1,46 @@
+/* See r303484 and r309342 */
+void
+t(void)
+{
+ /* The two if statements below excercise two different code paths. */
+
+ if (1) /* a */
+ int a;
+ else /* b */
+ int b;
+
+ if (1) /* a */
+ int a;
+ else /* b */
+ int b;
+
+ if (1)
+ {
+
+ }
+
+
+
+ /* Old indent would remove the 3 blank lines above, awaiting "else". */
+
+ if (1)
+ {
+ int a;
+ } else if (0)
+ {
+ int b;
+ }
+ /* test */
+ else
+ ;
+
+ if (1)
+ ;
+ else /* Old indent would get very confused here */
+ /* We also mustn't assume that there's only one comment */
+ /* before the left brace. */
+ {
+
+
+ }
+}
diff --git a/usr.bin/indent/tests/f_decls.0 b/usr.bin/indent/tests/f_decls.0
new file mode 100644
index 000000000000..dc175af40904
--- /dev/null
+++ b/usr.bin/indent/tests/f_decls.0
@@ -0,0 +1,28 @@
+
+char * x(void)
+{
+ type identifier;
+ type *pointer;
+ unused * value;
+ (void)unused * value;
+
+ dmax = (double)3 * 10.0;
+ dmin = (double)dmax * 10.0;
+ davg = (double)dmax * dmin;
+
+ return NULL;
+}
+
+int *
+y(void) {
+
+}
+
+int
+z(void) {
+
+}
+
+int x;
+int *y;
+int * * * * z;
diff --git a/usr.bin/indent/tests/f_decls.0.stdout b/usr.bin/indent/tests/f_decls.0.stdout
new file mode 100644
index 000000000000..1e95f9ae7e03
--- /dev/null
+++ b/usr.bin/indent/tests/f_decls.0.stdout
@@ -0,0 +1,31 @@
+
+char *
+x(void)
+{
+ type identifier;
+ type *pointer;
+ unused *value;
+ (void)unused * value;
+
+ dmax = (double)3 * 10.0;
+ dmin = (double)dmax * 10.0;
+ davg = (double)dmax * dmin;
+
+ return NULL;
+}
+
+int *
+y(void)
+{
+
+}
+
+int
+z(void)
+{
+
+}
+
+int x;
+int *y;
+int ****z;
diff --git a/usr.bin/indent/tests/float.0 b/usr.bin/indent/tests/float.0
new file mode 100644
index 000000000000..8ea2b41b7cc2
--- /dev/null
+++ b/usr.bin/indent/tests/float.0
@@ -0,0 +1,7 @@
+void t(void) {
+ unsigned long x = 314UL;
+ double y[] = {0x1P+9F, 0.3, .1, 1.2f, 0xa.p01f, 3.14f, 2.L};
+ int z = 0b0101;
+ DO_NOTHING;
+ x._y = 5;
+}
diff --git a/usr.bin/indent/tests/float.0.stdout b/usr.bin/indent/tests/float.0.stdout
new file mode 100644
index 000000000000..52bba26c2a3f
--- /dev/null
+++ b/usr.bin/indent/tests/float.0.stdout
@@ -0,0 +1,9 @@
+void
+t(void)
+{
+ unsigned long x = 314UL;
+ double y[] = {0x1P+9F, 0.3, .1, 1.2f, 0xa.p01f, 3.14f, 2.L};
+ int z = 0b0101;
+ DO_NOTHING;
+ x._y = 5;
+}
diff --git a/usr.bin/indent/tests/functional_test.sh b/usr.bin/indent/tests/functional_test.sh
new file mode 100755
index 000000000000..9cfe5878f69d
--- /dev/null
+++ b/usr.bin/indent/tests/functional_test.sh
@@ -0,0 +1,82 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright 2016 Dell EMC
+# All rights reserved.
+# Copyright (c) 2025 Klara, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+SRCDIR=$(atf_get_srcdir)
+
+check()
+{
+ local tc=${1}
+ local profile_flag
+
+ cp "${SRCDIR}/${tc%.[0-9]}".* .
+
+ if [ -f "${tc}.pro" ]; then
+ profile_flag="-P${tc}.pro"
+ else
+ # Make sure we don't implicitly use ~/.indent.pro from the test
+ # host, for determinism purposes.
+ profile_flag="-npro"
+ fi
+ atf_check -s exit:${tc##*.} -o file:"${tc}.stdout" \
+ indent ${profile_flag} < "${tc}"
+}
+
+add_legacy_testcase()
+{
+ local tc=${1}
+
+ atf_test_case ${tc%.[0-9]}
+ eval "${tc%.[0-9]}_body() { check ${tc}; }"
+ atf_add_test_case ${tc%.[0-9]}
+}
+
+atf_test_case backup_suffix
+backup_suffix_body()
+{
+ local argmax=$(sysctl -n kern.argmax)
+ local suffix=$(jot -b .bak -s '' $((argmax/5)))
+ local code=$'int main() {}\n'
+
+ printf "${code}" >input.c
+
+ atf_check indent input.c
+ atf_check -o inline:"${code}" cat input.c.BAK
+
+ atf_check -s exit:1 -e match:"name too long"\
+ env SIMPLE_BACKUP_SUFFIX=${suffix} indent input.c
+}
+
+atf_init_test_cases()
+{
+ for tc in $(find -s "${SRCDIR}" -name '*.[0-9]'); do
+ add_legacy_testcase "${tc##*/}"
+ done
+ atf_add_test_case backup_suffix
+}
diff --git a/usr.bin/indent/tests/label.0 b/usr.bin/indent/tests/label.0
new file mode 100644
index 000000000000..d4c54446e0bf
--- /dev/null
+++ b/usr.bin/indent/tests/label.0
@@ -0,0 +1,12 @@
+/* See r303489 */
+void t(void) {
+ switch (1)
+ {
+ case 1: /* test */
+ case 2: /* test */
+ }
+CLEANUP:
+ ;
+V: ;
+U: ;
+}
diff --git a/usr.bin/indent/tests/label.0.pro b/usr.bin/indent/tests/label.0.pro
new file mode 100644
index 000000000000..09d814950dfa
--- /dev/null
+++ b/usr.bin/indent/tests/label.0.pro
@@ -0,0 +1 @@
+-nut
diff --git a/usr.bin/indent/tests/label.0.stdout b/usr.bin/indent/tests/label.0.stdout
new file mode 100644
index 000000000000..ab1b985e9687
--- /dev/null
+++ b/usr.bin/indent/tests/label.0.stdout
@@ -0,0 +1,13 @@
+/* See r303489 */
+void
+t(void)
+{
+ switch (1) {
+ case 1: /* test */
+ case 2: /* test */
+ }
+CLEANUP:
+ ;
+V: ;
+U: ;
+}
diff --git a/usr.bin/indent/tests/list_head.0 b/usr.bin/indent/tests/list_head.0
new file mode 100644
index 000000000000..ec17a7bc1c9a
--- /dev/null
+++ b/usr.bin/indent/tests/list_head.0
@@ -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;
+
+
diff --git a/usr.bin/indent/tests/list_head.0.stdout b/usr.bin/indent/tests/list_head.0.stdout
new file mode 100644
index 000000000000..b74117a097e6
--- /dev/null
+++ b/usr.bin/indent/tests/list_head.0.stdout
@@ -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;
diff --git a/usr.bin/indent/tests/ncs.0 b/usr.bin/indent/tests/ncs.0
new file mode 100644
index 000000000000..129feeeeae4b
--- /dev/null
+++ b/usr.bin/indent/tests/ncs.0
@@ -0,0 +1,3 @@
+void t(void) {
+ int a = (double) 8;
+}
diff --git a/usr.bin/indent/tests/ncs.0.pro b/usr.bin/indent/tests/ncs.0.pro
new file mode 100644
index 000000000000..3f2185b2863a
--- /dev/null
+++ b/usr.bin/indent/tests/ncs.0.pro
@@ -0,0 +1 @@
+-ncs
diff --git a/usr.bin/indent/tests/ncs.0.stdout b/usr.bin/indent/tests/ncs.0.stdout
new file mode 100644
index 000000000000..e7ad0b5dbf12
--- /dev/null
+++ b/usr.bin/indent/tests/ncs.0.stdout
@@ -0,0 +1,5 @@
+void
+t(void)
+{
+ int a = (double)8;
+}
diff --git a/usr.bin/indent/tests/offsetof.0 b/usr.bin/indent/tests/offsetof.0
new file mode 100644
index 000000000000..c1870fa0daa3
--- /dev/null
+++ b/usr.bin/indent/tests/offsetof.0
@@ -0,0 +1,4 @@
+/* See r303718 */
+void t(void) {
+ int n = malloc(offsetof(struct s, f) + 1);
+}
diff --git a/usr.bin/indent/tests/offsetof.0.stdout b/usr.bin/indent/tests/offsetof.0.stdout
new file mode 100644
index 000000000000..dedf90e8ab3a
--- /dev/null
+++ b/usr.bin/indent/tests/offsetof.0.stdout
@@ -0,0 +1,6 @@
+/* See r303718 */
+void
+t(void)
+{
+ int n = malloc(offsetof(struct s, f) + 1);
+}
diff --git a/usr.bin/indent/tests/parens.0 b/usr.bin/indent/tests/parens.0
new file mode 100644
index 000000000000..5293ad7666a9
--- /dev/null
+++ b/usr.bin/indent/tests/parens.0
@@ -0,0 +1,26 @@
+typedef void (*xxxxxxxxxxx) (int,
+ char);
+
+typedef char (*xxxxxxxxxxxxxxxxxxxxxxxxxxxx) (int *,
+ unsigned *,
+ char,
+ float *);
+
+void
+test(void)
+{
+ char chars[secondf(firstf(B),
+ *here)];
+
+ float xxx = yyyyyyyyyyyyyy(zzzzzzzzzzzzz(p1,
+ (p2),
+ p3));
+
+ if (1) {
+ char *xxx = firstf(secondf2(p1,
+ p2));
+ }
+
+ rb->allocfunc(1);
+ rb2.allocfunc(7);
+}
diff --git a/usr.bin/indent/tests/parens.0.pro b/usr.bin/indent/tests/parens.0.pro
new file mode 100644
index 000000000000..e860911a1173
--- /dev/null
+++ b/usr.bin/indent/tests/parens.0.pro
@@ -0,0 +1 @@
+-ts4 -i4 -di12 -Tallocfunc
diff --git a/usr.bin/indent/tests/parens.0.stdout b/usr.bin/indent/tests/parens.0.stdout
new file mode 100644
index 000000000000..99433239bc30
--- /dev/null
+++ b/usr.bin/indent/tests/parens.0.stdout
@@ -0,0 +1,26 @@
+typedef void (*xxxxxxxxxxx) (int,
+ char);
+
+typedef char (*xxxxxxxxxxxxxxxxxxxxxxxxxxxx) (int *,
+ unsigned *,
+ char,
+ float *);
+
+void
+test(void)
+{
+ char chars[secondf(firstf(B),
+ *here)];
+
+ float xxx = yyyyyyyyyyyyyy(zzzzzzzzzzzzz(p1,
+ (p2),
+ p3));
+
+ if (1) {
+ char *xxx = firstf(secondf2(p1,
+ p2));
+ }
+
+ rb->allocfunc(1);
+ rb2.allocfunc(7);
+}
diff --git a/usr.bin/indent/tests/pcs.0 b/usr.bin/indent/tests/pcs.0
new file mode 100644
index 000000000000..9fd8aad863a1
--- /dev/null
+++ b/usr.bin/indent/tests/pcs.0
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void) {
+ puts("Hello");
+ return 0;
+}
diff --git a/usr.bin/indent/tests/pcs.0.pro b/usr.bin/indent/tests/pcs.0.pro
new file mode 100644
index 000000000000..60d7c2ccd850
--- /dev/null
+++ b/usr.bin/indent/tests/pcs.0.pro
@@ -0,0 +1 @@
+-pcs
diff --git a/usr.bin/indent/tests/pcs.0.stdout b/usr.bin/indent/tests/pcs.0.stdout
new file mode 100644
index 000000000000..013082de8b38
--- /dev/null
+++ b/usr.bin/indent/tests/pcs.0.stdout
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int
+main(void)
+{
+ puts ("Hello");
+ return 0;
+}
diff --git a/usr.bin/indent/tests/ps.0 b/usr.bin/indent/tests/ps.0
new file mode 100644
index 000000000000..0dc72ccfddf2
--- /dev/null
+++ b/usr.bin/indent/tests/ps.0
@@ -0,0 +1,4 @@
+struct s { int i; };
+void f(struct s *p) {
+ p->i--;
+}
diff --git a/usr.bin/indent/tests/ps.0.pro b/usr.bin/indent/tests/ps.0.pro
new file mode 100644
index 000000000000..5fdebee73785
--- /dev/null
+++ b/usr.bin/indent/tests/ps.0.pro
@@ -0,0 +1 @@
+-ps
diff --git a/usr.bin/indent/tests/ps.0.stdout b/usr.bin/indent/tests/ps.0.stdout
new file mode 100644
index 000000000000..08f421e984ff
--- /dev/null
+++ b/usr.bin/indent/tests/ps.0.stdout
@@ -0,0 +1,8 @@
+struct s {
+ int i;
+};
+void
+f(struct s *p)
+{
+ p -> i--;
+}
diff --git a/usr.bin/indent/tests/struct.0 b/usr.bin/indent/tests/struct.0
new file mode 100644
index 000000000000..784d387cc717
--- /dev/null
+++ b/usr.bin/indent/tests/struct.0
@@ -0,0 +1,20 @@
+
+int f(struct x *a);
+
+/* See r303485 */
+void
+t(void)
+{
+ static const struct {
+ int a;
+ int b;
+ } c[] = {
+ { D, E },
+ { F, G }
+ };
+}
+
+void u(struct x a) {
+ int b;
+ struct y c = (struct y *)&a;
+}
diff --git a/usr.bin/indent/tests/struct.0.stdout b/usr.bin/indent/tests/struct.0.stdout
new file mode 100644
index 000000000000..55b559ab9d6b
--- /dev/null
+++ b/usr.bin/indent/tests/struct.0.stdout
@@ -0,0 +1,22 @@
+
+int f(struct x *a);
+
+/* See r303485 */
+void
+t(void)
+{
+ static const struct {
+ int a;
+ int b;
+ } c[] = {
+ {D, E},
+ {F, G}
+ };
+}
+
+void
+u(struct x a)
+{
+ int b;
+ struct y c = (struct y *)&a;
+}
diff --git a/usr.bin/indent/tests/surplusbad.0 b/usr.bin/indent/tests/surplusbad.0
new file mode 100644
index 000000000000..f9f2bf80c24a
--- /dev/null
+++ b/usr.bin/indent/tests/surplusbad.0
@@ -0,0 +1,8 @@
+/* See r303599 */
+#if defined(__i386__)
+int a;
+#elif defined(__amd64__)
+int b;
+#else
+#error "Port me"
+#endif
diff --git a/usr.bin/indent/tests/surplusbad.0.pro b/usr.bin/indent/tests/surplusbad.0.pro
new file mode 100644
index 000000000000..b3fe0943ec66
--- /dev/null
+++ b/usr.bin/indent/tests/surplusbad.0.pro
@@ -0,0 +1 @@
+-bad
diff --git a/usr.bin/indent/tests/surplusbad.0.stdout b/usr.bin/indent/tests/surplusbad.0.stdout
new file mode 100644
index 000000000000..2f5856bc4092
--- /dev/null
+++ b/usr.bin/indent/tests/surplusbad.0.stdout
@@ -0,0 +1,8 @@
+/* See r303599 */
+#if defined(__i386__)
+int a;
+#elif defined(__amd64__)
+int b;
+#else
+#error "Port me"
+#endif
diff --git a/usr.bin/indent/tests/types_from_file.0 b/usr.bin/indent/tests/types_from_file.0
new file mode 100644
index 000000000000..c7673f55a0fc
--- /dev/null
+++ b/usr.bin/indent/tests/types_from_file.0
@@ -0,0 +1,2 @@
+/* See r303735 */
+void t(a *x, b *y, c *z);
diff --git a/usr.bin/indent/tests/types_from_file.0.list b/usr.bin/indent/tests/types_from_file.0.list
new file mode 100644
index 000000000000..5f733616b1b4
--- /dev/null
+++ b/usr.bin/indent/tests/types_from_file.0.list
@@ -0,0 +1,2 @@
+b
+a \ No newline at end of file
diff --git a/usr.bin/indent/tests/types_from_file.0.pro b/usr.bin/indent/tests/types_from_file.0.pro
new file mode 100644
index 000000000000..255b8817589b
--- /dev/null
+++ b/usr.bin/indent/tests/types_from_file.0.pro
@@ -0,0 +1 @@
+-Utypes_from_file.0.list
diff --git a/usr.bin/indent/tests/types_from_file.0.stdout b/usr.bin/indent/tests/types_from_file.0.stdout
new file mode 100644
index 000000000000..dca345ffafbf
--- /dev/null
+++ b/usr.bin/indent/tests/types_from_file.0.stdout
@@ -0,0 +1,2 @@
+/* See r303735 */
+void t(a *x, b *y, c * z);
diff --git a/usr.bin/indent/tests/wchar.0 b/usr.bin/indent/tests/wchar.0
new file mode 100644
index 000000000000..699703903373
--- /dev/null
+++ b/usr.bin/indent/tests/wchar.0
@@ -0,0 +1,5 @@
+/* See r309220 */
+#include <wchar.h>
+
+wchar_t *x = L"test";
+wchar_t y = L't';
diff --git a/usr.bin/indent/tests/wchar.0.stdout b/usr.bin/indent/tests/wchar.0.stdout
new file mode 100644
index 000000000000..a901b043328e
--- /dev/null
+++ b/usr.bin/indent/tests/wchar.0.stdout
@@ -0,0 +1,5 @@
+/* See r309220 */
+#include <wchar.h>
+
+wchar_t *x = L"test";
+wchar_t y = L't';