Module Name: src
Committed By: rillig
Date: Sun Mar 7 10:12:19 UTC 2021
Modified Files:
src/tests/usr.bin/indent: opt-P.0 opt-P.0.stdout opt-T.0 opt-T.0.stdout
opt-U.0 opt-U.0.stdout opt-lpl.0 opt-lpl.0.stdout opt-nlpl.0
opt-nlpl.0.stdout opt-npcs.0 opt-npcs.0.stdout opt-npro.0
opt-npro.0.stdout opt-npsl.0 opt-npsl.0.stdout opt-nsc.0
opt-nsc.0.stdout opt-nsob.0 opt-nsob.0.stdout opt-nut.0
opt-nut.0.stdout opt-nv.0 opt-nv.0.stdout opt-pcs.0
opt-pcs.0.stdout opt-psl.0 opt-psl.0.stdout opt-sc.0
opt-sc.0.stdout opt-sob.0 opt-sob.0.stdout opt-ta.0 opt-ta.0.stdout
opt-ts.0 opt-ts.0.stdout opt-ut.0 opt-ut.0.stdout opt-v.0
opt-v.0.stdout
Log Message:
tests/indent: add tests for the remaining command line options
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/opt-P.0 \
src/tests/usr.bin/indent/opt-P.0.stdout src/tests/usr.bin/indent/opt-T.0 \
src/tests/usr.bin/indent/opt-T.0.stdout src/tests/usr.bin/indent/opt-U.0 \
src/tests/usr.bin/indent/opt-U.0.stdout \
src/tests/usr.bin/indent/opt-lpl.0 \
src/tests/usr.bin/indent/opt-lpl.0.stdout \
src/tests/usr.bin/indent/opt-nlpl.0 \
src/tests/usr.bin/indent/opt-nlpl.0.stdout \
src/tests/usr.bin/indent/opt-npcs.0 \
src/tests/usr.bin/indent/opt-npcs.0.stdout \
src/tests/usr.bin/indent/opt-npro.0 \
src/tests/usr.bin/indent/opt-npro.0.stdout \
src/tests/usr.bin/indent/opt-npsl.0 \
src/tests/usr.bin/indent/opt-npsl.0.stdout \
src/tests/usr.bin/indent/opt-nsc.0 \
src/tests/usr.bin/indent/opt-nsc.0.stdout \
src/tests/usr.bin/indent/opt-nsob.0 \
src/tests/usr.bin/indent/opt-nsob.0.stdout \
src/tests/usr.bin/indent/opt-nut.0 \
src/tests/usr.bin/indent/opt-nut.0.stdout \
src/tests/usr.bin/indent/opt-nv.0 \
src/tests/usr.bin/indent/opt-nv.0.stdout \
src/tests/usr.bin/indent/opt-pcs.0 \
src/tests/usr.bin/indent/opt-pcs.0.stdout \
src/tests/usr.bin/indent/opt-psl.0 \
src/tests/usr.bin/indent/opt-psl.0.stdout \
src/tests/usr.bin/indent/opt-sc.0 \
src/tests/usr.bin/indent/opt-sc.0.stdout \
src/tests/usr.bin/indent/opt-sob.0 \
src/tests/usr.bin/indent/opt-sob.0.stdout \
src/tests/usr.bin/indent/opt-ta.0 \
src/tests/usr.bin/indent/opt-ta.0.stdout \
src/tests/usr.bin/indent/opt-ts.0 \
src/tests/usr.bin/indent/opt-ts.0.stdout \
src/tests/usr.bin/indent/opt-ut.0 \
src/tests/usr.bin/indent/opt-ut.0.stdout src/tests/usr.bin/indent/opt-v.0 \
src/tests/usr.bin/indent/opt-v.0.stdout
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/indent/opt-P.0
diff -u src/tests/usr.bin/indent/opt-P.0:1.1 src/tests/usr.bin/indent/opt-P.0:1.2
--- src/tests/usr.bin/indent/opt-P.0:1.1 Sat Mar 6 17:56:33 2021
+++ src/tests/usr.bin/indent/opt-P.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,8 @@
-/* $NetBSD: opt-P.0,v 1.1 2021/03/06 17:56:33 rillig Exp $ */
+/* $NetBSD: opt-P.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * Mentioning another profile via -P has no effect since only a single
+ * profile can be specified on the command line, and there is no 'include'
+ * option.
+ */
Index: src/tests/usr.bin/indent/opt-P.0.stdout
diff -u src/tests/usr.bin/indent/opt-P.0.stdout:1.1 src/tests/usr.bin/indent/opt-P.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-P.0.stdout:1.1 Sat Mar 6 17:56:33 2021
+++ src/tests/usr.bin/indent/opt-P.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,8 @@
-/* $NetBSD: opt-P.0.stdout,v 1.1 2021/03/06 17:56:33 rillig Exp $ */
+/* $NetBSD: opt-P.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * Mentioning another profile via -P has no effect since only a single
+ * profile can be specified on the command line, and there is no 'include'
+ * option.
+ */
Index: src/tests/usr.bin/indent/opt-T.0
diff -u src/tests/usr.bin/indent/opt-T.0:1.1 src/tests/usr.bin/indent/opt-T.0:1.2
--- src/tests/usr.bin/indent/opt-T.0:1.1 Sat Mar 6 17:56:33 2021
+++ src/tests/usr.bin/indent/opt-T.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,13 @@
-/* $NetBSD: opt-T.0,v 1.1 2021/03/06 17:56:33 rillig Exp $ */
+/* $NetBSD: opt-T.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void *arg)
+{
+ int cast = (custom_type_name) * arg;
+
+ int mult = (unknown_type_name) * arg;
+
+ /* See the option -ta for handling these types. */
+ int suff = (unknown_type_name_t) * arg;
+}
Index: src/tests/usr.bin/indent/opt-T.0.stdout
diff -u src/tests/usr.bin/indent/opt-T.0.stdout:1.1 src/tests/usr.bin/indent/opt-T.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-T.0.stdout:1.1 Sat Mar 6 17:56:33 2021
+++ src/tests/usr.bin/indent/opt-T.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,13 @@
-/* $NetBSD: opt-T.0.stdout,v 1.1 2021/03/06 17:56:33 rillig Exp $ */
+/* $NetBSD: opt-T.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void *arg)
+{
+ int cast = (custom_type_name)*arg;
+
+ int mult = (unknown_type_name) * arg;
+
+ /* See the option -ta for handling these types. */
+ int suff = (unknown_type_name_t) * arg;
+}
Index: src/tests/usr.bin/indent/opt-U.0
diff -u src/tests/usr.bin/indent/opt-U.0:1.1 src/tests/usr.bin/indent/opt-U.0:1.2
--- src/tests/usr.bin/indent/opt-U.0:1.1 Sat Mar 6 17:56:33 2021
+++ src/tests/usr.bin/indent/opt-U.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,10 @@
-/* $NetBSD: opt-U.0,v 1.1 2021/03/06 17:56:33 rillig Exp $ */
+/* $NetBSD: opt-U.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void *arg)
+{
+ int known_1 = (size_t) * arg;
+ int known_2 = (off_t) * arg;
+ int ignored = (ignored_t) * arg;
+}
Index: src/tests/usr.bin/indent/opt-U.0.stdout
diff -u src/tests/usr.bin/indent/opt-U.0.stdout:1.1 src/tests/usr.bin/indent/opt-U.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-U.0.stdout:1.1 Sat Mar 6 17:56:33 2021
+++ src/tests/usr.bin/indent/opt-U.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,10 @@
-/* $NetBSD: opt-U.0.stdout,v 1.1 2021/03/06 17:56:33 rillig Exp $ */
+/* $NetBSD: opt-U.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void *arg)
+{
+ int known_1 = (size_t)*arg;
+ int known_2 = (off_t)*arg;
+ int ignored = (ignored_t) * arg;
+}
Index: src/tests/usr.bin/indent/opt-lpl.0
diff -u src/tests/usr.bin/indent/opt-lpl.0:1.1 src/tests/usr.bin/indent/opt-lpl.0:1.2
--- src/tests/usr.bin/indent/opt-lpl.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-lpl.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,24 @@
-/* $NetBSD: opt-lpl.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-lpl.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ int sum1 = 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21;
+ int sum2 = (1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21);
+
+ int sum3 = 1+2+3+4+5+
+ 6+7+8+9+10+
+ 11+12+13+14+15+
+ 16+17+18+19+20+
+ 21;
+ int sum4 = (1+2+3+4+5+
+ 6+7+8+9+10+
+ 11+12+13+14+15+
+ 16+17+18+19+20+
+ 21);
+
+ call_function(call_function(call_function(call_function(call_function(call_function())))));
+
+ call_function((call_function(call_function(call_function(call_function(call_function()))))));
+}
Index: src/tests/usr.bin/indent/opt-lpl.0.stdout
diff -u src/tests/usr.bin/indent/opt-lpl.0.stdout:1.1 src/tests/usr.bin/indent/opt-lpl.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-lpl.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-lpl.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,27 @@
-/* $NetBSD: opt-lpl.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-lpl.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* $ TODO: Add code that differs between -lpl and -nlpl. */
+void
+example(void)
+{
+ int sum1 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21;
+ int sum2 = (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21);
+
+/* $ XXX: There should be at least _some_ indentation for the */
+/* $ continuation lines. */
+ int sum3 = 1 + 2 + 3 + 4 + 5 +
+ 6 + 7 + 8 + 9 + 10 +
+ 11 + 12 + 13 + 14 + 15 +
+ 16 + 17 + 18 + 19 + 20 +
+ 21;
+ int sum4 = (1 + 2 + 3 + 4 + 5 +
+ 6 + 7 + 8 + 9 + 10 +
+ 11 + 12 + 13 + 14 + 15 +
+ 16 + 17 + 18 + 19 + 20 +
+ 21);
+
+ call_function(call_function(call_function(call_function(call_function(call_function())))));
+
+ call_function((call_function(call_function(call_function(call_function(call_function()))))));
+}
Index: src/tests/usr.bin/indent/opt-nlpl.0
diff -u src/tests/usr.bin/indent/opt-nlpl.0:1.1 src/tests/usr.bin/indent/opt-nlpl.0:1.2
--- src/tests/usr.bin/indent/opt-nlpl.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nlpl.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,24 @@
-/* $NetBSD: opt-nlpl.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nlpl.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ int sum1 = 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21;
+ int sum2 = (1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21);
+
+ int sum3 = 1+2+3+4+5+
+ 6+7+8+9+10+
+ 11+12+13+14+15+
+ 16+17+18+19+20+
+ 21;
+ int sum4 = (1+2+3+4+5+
+ 6+7+8+9+10+
+ 11+12+13+14+15+
+ 16+17+18+19+20+
+ 21);
+
+ call_function(call_function(call_function(call_function(call_function(call_function())))));
+
+ call_function((call_function(call_function(call_function(call_function(call_function()))))));
+}
Index: src/tests/usr.bin/indent/opt-nlpl.0.stdout
diff -u src/tests/usr.bin/indent/opt-nlpl.0.stdout:1.1 src/tests/usr.bin/indent/opt-nlpl.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-nlpl.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nlpl.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,27 @@
-/* $NetBSD: opt-nlpl.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nlpl.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* $ TODO: Add code that differs between -lpl and -nlpl. */
+void
+example(void)
+{
+ int sum1 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21;
+ int sum2 = (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21);
+
+/* $ XXX: There should be at least _some_ indentation for the */
+/* $ continuation lines. */
+ int sum3 = 1 + 2 + 3 + 4 + 5 +
+ 6 + 7 + 8 + 9 + 10 +
+ 11 + 12 + 13 + 14 + 15 +
+ 16 + 17 + 18 + 19 + 20 +
+ 21;
+ int sum4 = (1 + 2 + 3 + 4 + 5 +
+ 6 + 7 + 8 + 9 + 10 +
+ 11 + 12 + 13 + 14 + 15 +
+ 16 + 17 + 18 + 19 + 20 +
+ 21);
+
+ call_function(call_function(call_function(call_function(call_function(call_function())))));
+
+ call_function((call_function(call_function(call_function(call_function(call_function()))))));
+}
Index: src/tests/usr.bin/indent/opt-npcs.0
diff -u src/tests/usr.bin/indent/opt-npcs.0:1.1 src/tests/usr.bin/indent/opt-npcs.0:1.2
--- src/tests/usr.bin/indent/opt-npcs.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-npcs.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,10 @@
-/* $NetBSD: opt-npcs.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-npcs.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ function_call();
+ function_call(1);
+ function_call(1,2,3);
+}
Index: src/tests/usr.bin/indent/opt-npcs.0.stdout
diff -u src/tests/usr.bin/indent/opt-npcs.0.stdout:1.1 src/tests/usr.bin/indent/opt-npcs.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-npcs.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-npcs.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,10 @@
-/* $NetBSD: opt-npcs.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-npcs.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ function_call();
+ function_call(1);
+ function_call(1, 2, 3);
+}
Index: src/tests/usr.bin/indent/opt-npro.0
diff -u src/tests/usr.bin/indent/opt-npro.0:1.1 src/tests/usr.bin/indent/opt-npro.0:1.2
--- src/tests/usr.bin/indent/opt-npro.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-npro.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,8 @@
-/* $NetBSD: opt-npro.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-npro.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * Mentioning the option -npro in a .pro file has no effect since at that
+ * point, indent has already decided to load the .pro file, and it only
+ * decides once.
+ */
Index: src/tests/usr.bin/indent/opt-npro.0.stdout
diff -u src/tests/usr.bin/indent/opt-npro.0.stdout:1.1 src/tests/usr.bin/indent/opt-npro.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-npro.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-npro.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,8 @@
-/* $NetBSD: opt-npro.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-npro.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * Mentioning the option -npro in a .pro file has no effect since at that
+ * point, indent has already decided to load the .pro file, and it only
+ * decides once.
+ */
Index: src/tests/usr.bin/indent/opt-npsl.0
diff -u src/tests/usr.bin/indent/opt-npsl.0:1.1 src/tests/usr.bin/indent/opt-npsl.0:1.2
--- src/tests/usr.bin/indent/opt-npsl.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-npsl.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,6 @@
-/* $NetBSD: opt-npsl.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-npsl.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void function_declaration(void);
+
+void function_definition(void) {}
Index: src/tests/usr.bin/indent/opt-npsl.0.stdout
diff -u src/tests/usr.bin/indent/opt-npsl.0.stdout:1.1 src/tests/usr.bin/indent/opt-npsl.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-npsl.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-npsl.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,8 @@
-/* $NetBSD: opt-npsl.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-npsl.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void function_declaration(void);
+
+void function_definition(void)
+{
+}
Index: src/tests/usr.bin/indent/opt-nsc.0
diff -u src/tests/usr.bin/indent/opt-nsc.0:1.1 src/tests/usr.bin/indent/opt-nsc.0:1.2
--- src/tests/usr.bin/indent/opt-nsc.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nsc.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,15 @@
-/* $NetBSD: opt-nsc.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nsc.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* comment
+without
+asterisks
+*/
+
+/*
+** This comment style is used by Lua.
+*/
+
+/**
+ * Javadoc, adopted by several other programming languages.
+ */
Index: src/tests/usr.bin/indent/opt-nsc.0.stdout
diff -u src/tests/usr.bin/indent/opt-nsc.0.stdout:1.1 src/tests/usr.bin/indent/opt-nsc.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-nsc.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nsc.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,15 @@
-/* $NetBSD: opt-nsc.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nsc.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+comment without asterisks
+ */
+
+/* $ This comment, as rewritten by indent, is not actually used by Lua. */
+/*
+ * This comment style is used by Lua.
+ */
+
+/**
+ * Javadoc, adopted by several other programming languages.
+ */
Index: src/tests/usr.bin/indent/opt-nsob.0
diff -u src/tests/usr.bin/indent/opt-nsob.0:1.1 src/tests/usr.bin/indent/opt-nsob.0:1.2
--- src/tests/usr.bin/indent/opt-nsob.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nsob.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,22 @@
-/* $NetBSD: opt-nsob.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nsob.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void function_declaration(void);
+
+
+
+int
+function_definition(void)
+{
+
+
+ int var;
+
+
+ var = value;
+
+
+ return var;
+
+
+}
Index: src/tests/usr.bin/indent/opt-nsob.0.stdout
diff -u src/tests/usr.bin/indent/opt-nsob.0.stdout:1.1 src/tests/usr.bin/indent/opt-nsob.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-nsob.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nsob.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,22 @@
-/* $NetBSD: opt-nsob.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nsob.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void function_declaration(void);
+
+
+
+int
+function_definition(void)
+{
+
+
+ int var;
+
+
+ var = value;
+
+
+ return var;
+
+
+}
Index: src/tests/usr.bin/indent/opt-nut.0
diff -u src/tests/usr.bin/indent/opt-nut.0:1.1 src/tests/usr.bin/indent/opt-nut.0:1.2
--- src/tests/usr.bin/indent/opt-nut.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nut.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,13 @@
-/* $NetBSD: opt-nut.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nut.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int var;
+
+void
+function(int arg)
+{
+ if (arg > 0)
+ function(
+ arg - 1
+ );
+}
Index: src/tests/usr.bin/indent/opt-nut.0.stdout
diff -u src/tests/usr.bin/indent/opt-nut.0.stdout:1.1 src/tests/usr.bin/indent/opt-nut.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-nut.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nut.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,13 @@
-/* $NetBSD: opt-nut.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nut.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int var;
+
+void
+function(int arg)
+{
+ if (arg > 0)
+ function(
+ arg - 1
+ );
+}
Index: src/tests/usr.bin/indent/opt-nv.0
diff -u src/tests/usr.bin/indent/opt-nv.0:1.1 src/tests/usr.bin/indent/opt-nv.0:1.2
--- src/tests/usr.bin/indent/opt-nv.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nv.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,9 @@
-/* $NetBSD: opt-nv.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nv.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ int sum1 = 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21;
+ int sum2 = (1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21);
+}
Index: src/tests/usr.bin/indent/opt-nv.0.stdout
diff -u src/tests/usr.bin/indent/opt-nv.0.stdout:1.1 src/tests/usr.bin/indent/opt-nv.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-nv.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nv.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,11 @@
-/* $NetBSD: opt-nv.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nv.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+/* $ XXX: The following lines are too long and should thus be broken. */
+/* $ XXX: If they are broken, -nv does NOT output 'Line broken'. */
+ int sum1 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21;
+ int sum2 = (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21);
+}
Index: src/tests/usr.bin/indent/opt-pcs.0
diff -u src/tests/usr.bin/indent/opt-pcs.0:1.1 src/tests/usr.bin/indent/opt-pcs.0:1.2
--- src/tests/usr.bin/indent/opt-pcs.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-pcs.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,10 @@
-/* $NetBSD: opt-pcs.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-pcs.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ function_call();
+ function_call(1);
+ function_call(1,2,3);
+}
Index: src/tests/usr.bin/indent/opt-pcs.0.stdout
diff -u src/tests/usr.bin/indent/opt-pcs.0.stdout:1.1 src/tests/usr.bin/indent/opt-pcs.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-pcs.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-pcs.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,10 @@
-/* $NetBSD: opt-pcs.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-pcs.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ function_call ();
+ function_call (1);
+ function_call (1, 2, 3);
+}
Index: src/tests/usr.bin/indent/opt-psl.0
diff -u src/tests/usr.bin/indent/opt-psl.0:1.1 src/tests/usr.bin/indent/opt-psl.0:1.2
--- src/tests/usr.bin/indent/opt-psl.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-psl.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,6 @@
-/* $NetBSD: opt-psl.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-psl.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void function_declaration(void);
+
+void function_definition(void) {}
Index: src/tests/usr.bin/indent/opt-psl.0.stdout
diff -u src/tests/usr.bin/indent/opt-psl.0.stdout:1.1 src/tests/usr.bin/indent/opt-psl.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-psl.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-psl.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,9 @@
-/* $NetBSD: opt-psl.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-psl.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void function_declaration(void);
+
+void
+function_definition(void)
+{
+}
Index: src/tests/usr.bin/indent/opt-sc.0
diff -u src/tests/usr.bin/indent/opt-sc.0:1.1 src/tests/usr.bin/indent/opt-sc.0:1.2
--- src/tests/usr.bin/indent/opt-sc.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-sc.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,15 @@
-/* $NetBSD: opt-sc.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-sc.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* comment
+without
+asterisks
+*/
+
+/*
+** This comment style is used by Lua.
+*/
+
+/**
+ * Javadoc, adopted by several other programming languages.
+ */
Index: src/tests/usr.bin/indent/opt-sc.0.stdout
diff -u src/tests/usr.bin/indent/opt-sc.0.stdout:1.1 src/tests/usr.bin/indent/opt-sc.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-sc.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-sc.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,15 @@
-/* $NetBSD: opt-sc.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-sc.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * comment without asterisks
+ */
+
+/* $ XXX: The additional '*' is debatable. */
+/*
+ * * This comment style is used by Lua.
+ */
+
+/**
+ * Javadoc, adopted by several other programming languages.
+ */
Index: src/tests/usr.bin/indent/opt-sob.0
diff -u src/tests/usr.bin/indent/opt-sob.0:1.1 src/tests/usr.bin/indent/opt-sob.0:1.2
--- src/tests/usr.bin/indent/opt-sob.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-sob.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,24 @@
-/* $NetBSD: opt-sob.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-sob.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* $ FIXME: There are lots of 'optional blank lines' here that should */
+/* $ FIXME: be swallowed. */
+void function_declaration(void);
+
+
+
+int
+function_definition(void)
+{
+
+
+ int var;
+
+
+ var = value;
+
+
+ return var;
+
+
+}
Index: src/tests/usr.bin/indent/opt-sob.0.stdout
diff -u src/tests/usr.bin/indent/opt-sob.0.stdout:1.1 src/tests/usr.bin/indent/opt-sob.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-sob.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-sob.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,22 @@
-/* $NetBSD: opt-sob.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-sob.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void function_declaration(void);
+
+
+
+int
+function_definition(void)
+{
+
+
+ int var;
+
+
+ var = value;
+
+
+ return var;
+
+
+}
Index: src/tests/usr.bin/indent/opt-ta.0
diff -u src/tests/usr.bin/indent/opt-ta.0:1.1 src/tests/usr.bin/indent/opt-ta.0:1.2
--- src/tests/usr.bin/indent/opt-ta.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-ta.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,10 @@
-/* $NetBSD: opt-ta.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ta.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void *arg)
+{
+ int mult = (unknown_type_name) * arg;
+
+ int suff = (unknown_type_name_t) * arg;
+}
Index: src/tests/usr.bin/indent/opt-ta.0.stdout
diff -u src/tests/usr.bin/indent/opt-ta.0.stdout:1.1 src/tests/usr.bin/indent/opt-ta.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-ta.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-ta.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,10 @@
-/* $NetBSD: opt-ta.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ta.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void *arg)
+{
+ int mult = (unknown_type_name) * arg;
+
+ int suff = (unknown_type_name_t)*arg;
+}
Index: src/tests/usr.bin/indent/opt-ts.0
diff -u src/tests/usr.bin/indent/opt-ts.0:1.1 src/tests/usr.bin/indent/opt-ts.0:1.2
--- src/tests/usr.bin/indent/opt-ts.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-ts.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,16 @@
-/* $NetBSD: opt-ts.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ts.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * Since in this test, a tab is only worth 4 spaces, the indentation needs
+ * more tabs to reach the indentation of 8 and the alignment at 16.
+ */
+
+int variable;
+
+void
+function(void)
+{
+ int local_variable;
+ char local_variable;
+}
Index: src/tests/usr.bin/indent/opt-ts.0.stdout
diff -u src/tests/usr.bin/indent/opt-ts.0.stdout:1.1 src/tests/usr.bin/indent/opt-ts.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-ts.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-ts.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,16 @@
-/* $NetBSD: opt-ts.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ts.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * Since in this test, a tab is only worth 4 spaces, the indentation needs
+ * more tabs to reach the indentation of 8 and the alignment at 16.
+ */
+
+int variable;
+
+void
+function(void)
+{
+ int local_variable;
+ char local_variable;
+}
Index: src/tests/usr.bin/indent/opt-ut.0
diff -u src/tests/usr.bin/indent/opt-ut.0:1.1 src/tests/usr.bin/indent/opt-ut.0:1.2
--- src/tests/usr.bin/indent/opt-ut.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-ut.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,12 @@
-/* $NetBSD: opt-ut.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ut.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int variable;
+
+void function_declaration(void);
+
+void
+function_definition(void)
+{
+ int local_variable;
+}
Index: src/tests/usr.bin/indent/opt-ut.0.stdout
diff -u src/tests/usr.bin/indent/opt-ut.0.stdout:1.1 src/tests/usr.bin/indent/opt-ut.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-ut.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-ut.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,4 +1,12 @@
-/* $NetBSD: opt-ut.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ut.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int variable;
+
+void function_declaration(void);
+
+void
+function_definition(void)
+{
+ int local_variable;
+}
Index: src/tests/usr.bin/indent/opt-v.0
diff -u src/tests/usr.bin/indent/opt-v.0:1.1 src/tests/usr.bin/indent/opt-v.0:1.2
--- src/tests/usr.bin/indent/opt-v.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-v.0 Sun Mar 7 10:12:18 2021
@@ -1,4 +1,11 @@
-/* $NetBSD: opt-v.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-v.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * A long comment.
+ */
+void
+example(void)
+{
+ printf("A very long message template with %d arguments: %s, %s, %s", 3, "first", "second", "third");
+}
Index: src/tests/usr.bin/indent/opt-v.0.stdout
diff -u src/tests/usr.bin/indent/opt-v.0.stdout:1.1 src/tests/usr.bin/indent/opt-v.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-v.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-v.0.stdout Sun Mar 7 10:12:18 2021
@@ -1,6 +1,13 @@
-/* $NetBSD: opt-v.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-v.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
-There were 1 output lines and 1 comments
-(Lines with comments)/(Lines with code): inf
+/*
+ * A long comment.
+ */
+void
+example(void)
+{
+ printf("A very long message template with %d arguments: %s, %s, %s", 3, "first", "second", "third");
+}
+There were 8 output lines and 1 comments
+(Lines with comments)/(Lines with code): 0.600