Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/indent tests/indent: add more tests, discover ...



details:   https://anonhg.NetBSD.org/src/rev/c38e4d5a328c
branches:  trunk
changeset: 953345:c38e4d5a328c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 06 22:10:40 2021 +0000

description:
tests/indent: add more tests, discover more bugs

diffstat:

 tests/usr.bin/indent/opt-fcb.0         |  32 ++++++++++++++++++++++++++++++--
 tests/usr.bin/indent/opt-fcb.0.stdout  |  32 ++++++++++++++++++++++++++++++--
 tests/usr.bin/indent/opt-i.0           |   8 ++++++--
 tests/usr.bin/indent/opt-i.0.stdout    |  11 +++++++++--
 tests/usr.bin/indent/opt-ip.0          |  21 +++++++++++++++++++--
 tests/usr.bin/indent/opt-ip.0.stdout   |  21 +++++++++++++++++++--
 tests/usr.bin/indent/opt-l.0           |  21 +++++++++++++++++++--
 tests/usr.bin/indent/opt-l.0.stdout    |  26 ++++++++++++++++++++++++--
 tests/usr.bin/indent/opt-lc.0          |  19 +++++++++++++++++--
 tests/usr.bin/indent/opt-lc.0.stdout   |  21 +++++++++++++++++++--
 tests/usr.bin/indent/opt-ldi.0         |  11 +++++++++--
 tests/usr.bin/indent/opt-ldi.0.stdout  |  11 +++++++++--
 tests/usr.bin/indent/opt-lp.0          |  14 ++++++++++++--
 tests/usr.bin/indent/opt-lp.0.stdout   |  14 ++++++++++++--
 tests/usr.bin/indent/opt-nfcb.0        |  32 ++++++++++++++++++++++++++++++--
 tests/usr.bin/indent/opt-nfcb.0.stdout |  32 ++++++++++++++++++++++++++++++--
 tests/usr.bin/indent/opt-nip.0         |  21 +++++++++++++++++++--
 tests/usr.bin/indent/opt-nip.0.stdout  |  21 +++++++++++++++++++--
 tests/usr.bin/indent/opt-nlp.0         |  14 ++++++++++++--
 tests/usr.bin/indent/opt-nlp.0.stdout  |  14 ++++++++++++--
 20 files changed, 356 insertions(+), 40 deletions(-)

diffs (truncated from 516 to 300 lines):

diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-fcb.0
--- a/tests/usr.bin/indent/opt-fcb.0    Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-fcb.0    Sat Mar 06 22:10:40 2021 +0000
@@ -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       .
+        */
+}
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-fcb.0.stdout
--- a/tests/usr.bin/indent/opt-fcb.0.stdout     Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-fcb.0.stdout     Sat Mar 06 22:10:40 2021 +0000
@@ -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       .
+        */
+}
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-i.0
--- a/tests/usr.bin/indent/opt-i.0      Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-i.0      Sat Mar 06 22:10:40 2021 +0000
@@ -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;
+}
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-i.0.stdout
--- a/tests/usr.bin/indent/opt-i.0.stdout       Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-i.0.stdout       Sat Mar 06 22:10:40 2021 +0000
@@ -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;
+}
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-ip.0
--- a/tests/usr.bin/indent/opt-ip.0     Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-ip.0     Sat Mar 06 22:10:40 2021 +0000
@@ -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);
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-ip.0.stdout
--- a/tests/usr.bin/indent/opt-ip.0.stdout      Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-ip.0.stdout      Sat Mar 06 22:10:40 2021 +0000
@@ -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);
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-l.0
--- a/tests/usr.bin/indent/opt-l.0      Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-l.0      Sat Mar 06 22:10:40 2021 +0000
@@ -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);
+}
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-l.0.stdout
--- a/tests/usr.bin/indent/opt-l.0.stdout       Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-l.0.stdout       Sat Mar 06 22:10:40 2021 +0000
@@ -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);
+}
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-lc.0
--- a/tests/usr.bin/indent/opt-lc.0     Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-lc.0     Sat Mar 06 22:10:40 2021 +0000
@@ -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);
+}
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-lc.0.stdout
--- a/tests/usr.bin/indent/opt-lc.0.stdout      Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-lc.0.stdout      Sat Mar 06 22:10:40 2021 +0000
@@ -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);
+}
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-ldi.0
--- a/tests/usr.bin/indent/opt-ldi.0    Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-ldi.0    Sat Mar 06 22:10:40 2021 +0000
@@ -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;
+}
diff -r f2983783828a -r c38e4d5a328c tests/usr.bin/indent/opt-ldi.0.stdout
--- a/tests/usr.bin/indent/opt-ldi.0.stdout     Sat Mar 06 21:27:39 2021 +0000
+++ b/tests/usr.bin/indent/opt-ldi.0.stdout     Sat Mar 06 22:10:40 2021 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index