Module Name: src
Committed By: rillig
Date: Sat Mar 6 22:10:40 UTC 2021
Modified Files:
src/tests/usr.bin/indent: opt-fcb.0 opt-fcb.0.stdout opt-i.0
opt-i.0.stdout opt-ip.0 opt-ip.0.stdout opt-l.0 opt-l.0.stdout
opt-lc.0 opt-lc.0.stdout opt-ldi.0 opt-ldi.0.stdout opt-lp.0
opt-lp.0.stdout opt-nfcb.0 opt-nfcb.0.stdout opt-nip.0
opt-nip.0.stdout opt-nlp.0 opt-nlp.0.stdout
Log Message:
tests/indent: add more tests, discover more bugs
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/opt-fcb.0 \
src/tests/usr.bin/indent/opt-fcb.0.stdout \
src/tests/usr.bin/indent/opt-i.0 src/tests/usr.bin/indent/opt-i.0.stdout \
src/tests/usr.bin/indent/opt-ip.0 \
src/tests/usr.bin/indent/opt-ip.0.stdout src/tests/usr.bin/indent/opt-l.0 \
src/tests/usr.bin/indent/opt-l.0.stdout src/tests/usr.bin/indent/opt-lc.0 \
src/tests/usr.bin/indent/opt-lc.0.stdout \
src/tests/usr.bin/indent/opt-ldi.0 \
src/tests/usr.bin/indent/opt-ldi.0.stdout \
src/tests/usr.bin/indent/opt-lp.0 \
src/tests/usr.bin/indent/opt-lp.0.stdout \
src/tests/usr.bin/indent/opt-nfcb.0 \
src/tests/usr.bin/indent/opt-nfcb.0.stdout \
src/tests/usr.bin/indent/opt-nip.0 \
src/tests/usr.bin/indent/opt-nip.0.stdout \
src/tests/usr.bin/indent/opt-nlp.0 \
src/tests/usr.bin/indent/opt-nlp.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-fcb.0
diff -u src/tests/usr.bin/indent/opt-fcb.0:1.1 src/tests/usr.bin/indent/opt-fcb.0:1.2
--- src/tests/usr.bin/indent/opt-fcb.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-fcb.0 Sat Mar 6 22:10:40 2021
@@ -1,4 +1,32 @@
-/* $NetBSD: opt-fcb.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-fcb.0,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* FIXME: The options -fcb and -nfcb result in exactly the same output. */
+
+/* Not
+ *
+ * so carefully
+ * formatted
+ * comment */
+
+/*-
+ * car mat men
+ * efu for ted com t
+ * lly box .
+ */
+
+void
+example(void)
+{
+ /* Not
+ *
+ * so carefully
+ * formatted
+ * comment */
+
+ /*-
+ * car mat men
+ * efu for ted com t
+ * lly box .
+ */
+}
Index: src/tests/usr.bin/indent/opt-fcb.0.stdout
diff -u src/tests/usr.bin/indent/opt-fcb.0.stdout:1.1 src/tests/usr.bin/indent/opt-fcb.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-fcb.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-fcb.0.stdout Sat Mar 6 22:10:40 2021
@@ -1,4 +1,32 @@
-/* $NetBSD: opt-fcb.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-fcb.0.stdout,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* FIXME: The options -fcb and -nfcb result in exactly the same output. */
+
+/*
+ * Not
+ *
+ * so carefully formatted comment
+ */
+
+/*-
+ * car mat men
+ * efu for ted com t
+ * lly box .
+ */
+
+void
+example(void)
+{
+ /*
+ * Not
+ *
+ * so carefully formatted comment
+ */
+
+ /*-
+ * car mat men
+ * efu for ted com t
+ * lly box .
+ */
+}
Index: src/tests/usr.bin/indent/opt-i.0
diff -u src/tests/usr.bin/indent/opt-i.0:1.1 src/tests/usr.bin/indent/opt-i.0:1.2
--- src/tests/usr.bin/indent/opt-i.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-i.0 Sat Mar 6 22:10:40 2021
@@ -1,4 +1,8 @@
-/* $NetBSD: opt-i.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-i.0,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ if (1 > 0) if (2 > 1) return yes; return no;
+}
Index: src/tests/usr.bin/indent/opt-i.0.stdout
diff -u src/tests/usr.bin/indent/opt-i.0.stdout:1.1 src/tests/usr.bin/indent/opt-i.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-i.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-i.0.stdout Sat Mar 6 22:10:40 2021
@@ -1,4 +1,11 @@
-/* $NetBSD: opt-i.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-i.0.stdout,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ if (1 > 0)
+ if (2 > 1)
+ return yes;
+ return no;
+}
Index: src/tests/usr.bin/indent/opt-ip.0
diff -u src/tests/usr.bin/indent/opt-ip.0:1.1 src/tests/usr.bin/indent/opt-ip.0:1.2
--- src/tests/usr.bin/indent/opt-ip.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-ip.0 Sat Mar 6 22:10:40 2021
@@ -1,4 +1,21 @@
-/* $NetBSD: opt-ip.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ip.0,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* FIXME: The options -ip and -nip produce the same output. */
+
+int
+several_parameters_1(int a,
+int b,
+const char *cp);
+
+int
+several_parameters_2(
+int a,
+int b,
+const char *cp);
+
+int
+several_parameters_3(
+int a1, int a2,
+int b1, int b2,
+const char *cp);
Index: src/tests/usr.bin/indent/opt-ip.0.stdout
diff -u src/tests/usr.bin/indent/opt-ip.0.stdout:1.1 src/tests/usr.bin/indent/opt-ip.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-ip.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-ip.0.stdout Sat Mar 6 22:10:40 2021
@@ -1,4 +1,21 @@
-/* $NetBSD: opt-ip.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ip.0.stdout,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* FIXME: The options -ip and -nip produce the same output. */
+
+int
+several_parameters_1(int a,
+ int b,
+ const char *cp);
+
+int
+several_parameters_2(
+ int a,
+ int b,
+ const char *cp);
+
+int
+several_parameters_3(
+ int a1, int a2,
+ int b1, int b2,
+ const char *cp);
Index: src/tests/usr.bin/indent/opt-l.0
diff -u src/tests/usr.bin/indent/opt-l.0:1.1 src/tests/usr.bin/indent/opt-l.0:1.2
--- src/tests/usr.bin/indent/opt-l.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-l.0 Sat Mar 6 22:10:40 2021
@@ -1,4 +1,21 @@
-/* $NetBSD: opt-l.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-l.0,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * FIXME: Even though the line length is limited with -l38,
+ * the overly long lines in the code are not broken.
+ */
+
+/* FIXME: The options -l and -lc produce the same output. */
+
+void
+example(int a, int b, int c, const char *cp)
+{
+ for (const char *p = cp; *p != '\0'; p++)
+ if (*p > a)
+ if (*p > b)
+ if (*p > c)
+ return;
+
+ function(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+}
Index: src/tests/usr.bin/indent/opt-l.0.stdout
diff -u src/tests/usr.bin/indent/opt-l.0.stdout:1.1 src/tests/usr.bin/indent/opt-l.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-l.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-l.0.stdout Sat Mar 6 22:10:40 2021
@@ -1,4 +1,26 @@
-/* $NetBSD: opt-l.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-l.0.stdout,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * FIXME: Even though the line length
+ * is limited with -l38, the overly
+ * long lines in the code are not
+ * broken.
+ */
+
+/*
+ * FIXME: The options -l and -lc
+ * produce the same output.
+ */
+
+void
+example(int a, int b, int c, const char *cp)
+{
+ for (const char *p = cp; *p != '\0'; p++)
+ if (*p > a)
+ if (*p > b)
+ if (*p > c)
+ return;
+
+ function(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+}
Index: src/tests/usr.bin/indent/opt-lc.0
diff -u src/tests/usr.bin/indent/opt-lc.0:1.1 src/tests/usr.bin/indent/opt-lc.0:1.2
--- src/tests/usr.bin/indent/opt-lc.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-lc.0 Sat Mar 6 22:10:40 2021
@@ -1,4 +1,19 @@
-/* $NetBSD: opt-lc.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-lc.0,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * FIXME: Even though the line length is limited with -l38,
+ * the overly long lines in the code are not broken.
+ */
+
+void
+example(int a, int b, int c, const char *cp)
+{
+ for (const char *p = cp; *p != '\0'; p++)
+ if (*p > a)
+ if (*p > b)
+ if (*p > c)
+ return;
+
+ function(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+}
Index: src/tests/usr.bin/indent/opt-lc.0.stdout
diff -u src/tests/usr.bin/indent/opt-lc.0.stdout:1.1 src/tests/usr.bin/indent/opt-lc.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-lc.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-lc.0.stdout Sat Mar 6 22:10:40 2021
@@ -1,4 +1,21 @@
-/* $NetBSD: opt-lc.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-lc.0.stdout,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * FIXME: Even though the line length
+ * is limited with -l38, the overly
+ * long lines in the code are not
+ * broken.
+ */
+
+void
+example(int a, int b, int c, const char *cp)
+{
+ for (const char *p = cp; *p != '\0'; p++)
+ if (*p > a)
+ if (*p > b)
+ if (*p > c)
+ return;
+
+ function(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+}
Index: src/tests/usr.bin/indent/opt-ldi.0
diff -u src/tests/usr.bin/indent/opt-ldi.0:1.1 src/tests/usr.bin/indent/opt-ldi.0:1.2
--- src/tests/usr.bin/indent/opt-ldi.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-ldi.0 Sat Mar 6 22:10:40 2021
@@ -1,4 +1,11 @@
-/* $NetBSD: opt-ldi.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ldi.0,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* FIXME: Why does -ldi affect global variables? */
+int global;
+
+void
+function(void)
+{
+ int local;
+}
Index: src/tests/usr.bin/indent/opt-ldi.0.stdout
diff -u src/tests/usr.bin/indent/opt-ldi.0.stdout:1.1 src/tests/usr.bin/indent/opt-ldi.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-ldi.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-ldi.0.stdout Sat Mar 6 22:10:40 2021
@@ -1,4 +1,11 @@
-/* $NetBSD: opt-ldi.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ldi.0.stdout,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* FIXME: Why does -ldi affect global variables? */
+int global;
+
+void
+function(void)
+{
+ int local;
+}
Index: src/tests/usr.bin/indent/opt-lp.0
diff -u src/tests/usr.bin/indent/opt-lp.0:1.1 src/tests/usr.bin/indent/opt-lp.0:1.2
--- src/tests/usr.bin/indent/opt-lp.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-lp.0 Sat Mar 6 22:10:40 2021
@@ -1,4 +1,14 @@
-/* $NetBSD: opt-lp.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-lp.0,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ p1 = first_procedure(second_procedure(p2, p3),
+ third_procedure(p4, p5));
+
+ p1 = first_procedure(second_procedure(p2,
+ p3),
+ third_procedure(p4,
+ p5));
+}
Index: src/tests/usr.bin/indent/opt-lp.0.stdout
diff -u src/tests/usr.bin/indent/opt-lp.0.stdout:1.1 src/tests/usr.bin/indent/opt-lp.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-lp.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-lp.0.stdout Sat Mar 6 22:10:40 2021
@@ -1,4 +1,14 @@
-/* $NetBSD: opt-lp.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-lp.0.stdout,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ p1 = first_procedure(second_procedure(p2, p3),
+ third_procedure(p4, p5));
+
+ p1 = first_procedure(second_procedure(p2,
+ p3),
+ third_procedure(p4,
+ p5));
+}
Index: src/tests/usr.bin/indent/opt-nfcb.0
diff -u src/tests/usr.bin/indent/opt-nfcb.0:1.1 src/tests/usr.bin/indent/opt-nfcb.0:1.2
--- src/tests/usr.bin/indent/opt-nfcb.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nfcb.0 Sat Mar 6 22:10:40 2021
@@ -1,4 +1,32 @@
-/* $NetBSD: opt-nfcb.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nfcb.0,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* FIXME: The options -fcb and -nfcb result in exactly the same output. */
+
+/* Not
+ *
+ * so carefully
+ * formatted
+ * comment */
+
+/*-
+ * car mat men
+ * efu for ted com t
+ * lly box .
+ */
+
+void
+example(void)
+{
+ /* Not
+ *
+ * so carefully
+ * formatted
+ * comment */
+
+ /*-
+ * car mat men
+ * efu for ted com t
+ * lly box .
+ */
+}
Index: src/tests/usr.bin/indent/opt-nfcb.0.stdout
diff -u src/tests/usr.bin/indent/opt-nfcb.0.stdout:1.1 src/tests/usr.bin/indent/opt-nfcb.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-nfcb.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nfcb.0.stdout Sat Mar 6 22:10:40 2021
@@ -1,4 +1,32 @@
-/* $NetBSD: opt-nfcb.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nfcb.0.stdout,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* FIXME: The options -fcb and -nfcb result in exactly the same output. */
+
+/*
+ * Not
+ *
+ * so carefully formatted comment
+ */
+
+/*-
+ * car mat men
+ * efu for ted com t
+ * lly box .
+ */
+
+void
+example(void)
+{
+ /*
+ * Not
+ *
+ * so carefully formatted comment
+ */
+
+ /*-
+ * car mat men
+ * efu for ted com t
+ * lly box .
+ */
+}
Index: src/tests/usr.bin/indent/opt-nip.0
diff -u src/tests/usr.bin/indent/opt-nip.0:1.1 src/tests/usr.bin/indent/opt-nip.0:1.2
--- src/tests/usr.bin/indent/opt-nip.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nip.0 Sat Mar 6 22:10:40 2021
@@ -1,4 +1,21 @@
-/* $NetBSD: opt-nip.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nip.0,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* FIXME: The options -ip and -nip produce the same output. */
+
+int
+several_parameters_1(int a,
+int b,
+const char *cp);
+
+int
+several_parameters_2(
+int a,
+int b,
+const char *cp);
+
+int
+several_parameters_3(
+int a1, int a2,
+int b1, int b2,
+const char *cp);
Index: src/tests/usr.bin/indent/opt-nip.0.stdout
diff -u src/tests/usr.bin/indent/opt-nip.0.stdout:1.1 src/tests/usr.bin/indent/opt-nip.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-nip.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nip.0.stdout Sat Mar 6 22:10:40 2021
@@ -1,4 +1,21 @@
-/* $NetBSD: opt-nip.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nip.0.stdout,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* FIXME: The options -ip and -nip produce the same output. */
+
+int
+several_parameters_1(int a,
+ int b,
+ const char *cp);
+
+int
+several_parameters_2(
+ int a,
+ int b,
+ const char *cp);
+
+int
+several_parameters_3(
+ int a1, int a2,
+ int b1, int b2,
+ const char *cp);
Index: src/tests/usr.bin/indent/opt-nlp.0
diff -u src/tests/usr.bin/indent/opt-nlp.0:1.1 src/tests/usr.bin/indent/opt-nlp.0:1.2
--- src/tests/usr.bin/indent/opt-nlp.0:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nlp.0 Sat Mar 6 22:10:40 2021
@@ -1,4 +1,14 @@
-/* $NetBSD: opt-nlp.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nlp.0,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ p1 = first_procedure(second_procedure(p2, p3),
+ third_procedure(p4, p5));
+
+ p1 = first_procedure(second_procedure(p2,
+ p3),
+ third_procedure(p4,
+ p5));
+}
Index: src/tests/usr.bin/indent/opt-nlp.0.stdout
diff -u src/tests/usr.bin/indent/opt-nlp.0.stdout:1.1 src/tests/usr.bin/indent/opt-nlp.0.stdout:1.2
--- src/tests/usr.bin/indent/opt-nlp.0.stdout:1.1 Sat Mar 6 17:56:34 2021
+++ src/tests/usr.bin/indent/opt-nlp.0.stdout Sat Mar 6 22:10:40 2021
@@ -1,4 +1,14 @@
-/* $NetBSD: opt-nlp.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nlp.0.stdout,v 1.2 2021/03/06 22:10:40 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(void)
+{
+ p1 = first_procedure(second_procedure(p2, p3),
+ third_procedure(p4, p5));
+
+ p1 = first_procedure(second_procedure(p2,
+ p3),
+ third_procedure(p4,
+ p5));
+}