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 17 more tests, found ...
details: https://anonhg.NetBSD.org/src/rev/f2983783828a
branches: trunk
changeset: 953344:f2983783828a
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Mar 06 21:27:39 2021 +0000
description:
tests/indent: add 17 more tests, found only a single new bug
Discovering one bug in 17 command line options is acceptable. This
compensates the bad first impression I got in the previous batch of
tests, which consisted of 11 tests and found 8 bugs.
diffstat:
tests/usr.bin/indent/opt-cd.0 | 4 +-
tests/usr.bin/indent/opt-cd.0.stdout | 4 +-
tests/usr.bin/indent/opt-cdb.0 | 45 ++++++++++++++++++++++++++++++++-
tests/usr.bin/indent/opt-cdb.0.stdout | 35 ++++++++++++++++++++++++-
tests/usr.bin/indent/opt-ce.0 | 11 ++++++-
tests/usr.bin/indent/opt-ce.0.stdout | 16 ++++++++++-
tests/usr.bin/indent/opt-ci.0 | 9 +++++-
tests/usr.bin/indent/opt-ci.0.stdout | 9 +++++-
tests/usr.bin/indent/opt-cli.0 | 14 +++++++++-
tests/usr.bin/indent/opt-cli.0.stdout | 25 +++++++++++++++++-
tests/usr.bin/indent/opt-cs.0 | 6 +++-
tests/usr.bin/indent/opt-cs.0.stdout | 6 +++-
tests/usr.bin/indent/opt-d.0 | 19 ++++++++++++-
tests/usr.bin/indent/opt-d.0.stdout | 19 ++++++++++++-
tests/usr.bin/indent/opt-di.0 | 8 ++++-
tests/usr.bin/indent/opt-di.0.stdout | 8 ++++-
tests/usr.bin/indent/opt-dj.0 | 9 +++++-
tests/usr.bin/indent/opt-dj.0.stdout | 9 +++++-
tests/usr.bin/indent/opt-eei.0 | 14 +++++++++-
tests/usr.bin/indent/opt-eei.0.stdout | 14 +++++++++-
tests/usr.bin/indent/opt-ei.0 | 16 ++++++++++-
tests/usr.bin/indent/opt-ei.0.stdout | 16 ++++++++++-
tests/usr.bin/indent/opt-fbs.0 | 4 +-
tests/usr.bin/indent/opt-fbs.0.stdout | 7 +++-
tests/usr.bin/indent/opt-fc1.0 | 10 ++++++-
tests/usr.bin/indent/opt-fc1.0.stdout | 9 +++++-
tests/usr.bin/indent/opt-nce.0 | 11 ++++++-
tests/usr.bin/indent/opt-nce.0.stdout | 18 ++++++++++++-
tests/usr.bin/indent/opt-nei.0 | 16 ++++++++++-
tests/usr.bin/indent/opt-nei.0.stdout | 18 ++++++++++++-
tests/usr.bin/indent/opt-nfbs.0 | 4 +-
tests/usr.bin/indent/opt-nfbs.0.stdout | 6 +++-
tests/usr.bin/indent/opt-nfc1.0 | 10 ++++++-
tests/usr.bin/indent/opt-nfc1.0.stdout | 10 ++++++-
34 files changed, 371 insertions(+), 68 deletions(-)
diffs (truncated from 643 to 300 lines):
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-cd.0
--- a/tests/usr.bin/indent/opt-cd.0 Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-cd.0 Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt-cd.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-cd.0,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int aflag; /* Apply to all files. */
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-cd.0.stdout
--- a/tests/usr.bin/indent/opt-cd.0.stdout Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-cd.0.stdout Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt-cd.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-cd.0.stdout,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int aflag; /* Apply to all files. */
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-cdb.0
--- a/tests/usr.bin/indent/opt-cdb.0 Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-cdb.0 Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,45 @@
-/* $NetBSD: opt-cdb.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-cdb.0,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* A single-line comment. */
+
+/* A
+ * multi-line
+ * comment. */
+
+/*
+ * A
+ * multi-line
+ * comment.
+ */
+
+int ga; /* A single-line comment. */
+
+int gb; /* A
+ * multi-line
+ * comment. */
+
+int gc; /*
+ * A
+ * multi-line
+ * comment.
+ */
+
+void
+example(void)
+{
+ /* A single-line comment. */
+ int la;
+
+ /* A
+ * multi-line
+ * comment. */
+ int lb;
+
+ /*
+ * A
+ * multi-line
+ * comment.
+ */
+ int lc;
+}
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-cdb.0.stdout
--- a/tests/usr.bin/indent/opt-cdb.0.stdout Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-cdb.0.stdout Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,35 @@
-/* $NetBSD: opt-cdb.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-cdb.0.stdout,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* A single-line comment. */
+
+/*
+ * A multi-line comment.
+ */
+
+/*
+ * A multi-line comment.
+ */
+
+int ga; /* A single-line comment. */
+
+int gb; /* A multi-line comment. */
+
+int gc; /* A multi-line comment. */
+
+void
+example(void)
+{
+ /* A single-line comment. */
+ int la;
+
+ /*
+ * A multi-line comment.
+ */
+ int lb;
+
+ /*
+ * A multi-line comment.
+ */
+ int lc;
+}
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-ce.0
--- a/tests/usr.bin/indent/opt-ce.0 Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-ce.0 Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,11 @@
-/* $NetBSD: opt-ce.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ce.0,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(int n)
+{
+ if (n > 99) { print("large"); }
+ else if (n > 9) { print("double-digit"); }
+ else if (n > 0) print("positive");
+ else { print("negative"); }
+}
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-ce.0.stdout
--- a/tests/usr.bin/indent/opt-ce.0.stdout Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-ce.0.stdout Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,16 @@
-/* $NetBSD: opt-ce.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ce.0.stdout,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+example(int n)
+{
+ if (n > 99) {
+ print("large");
+ } else if (n > 9) {
+ print("double-digit");
+ } else if (n > 0)
+ print("positive");
+ else {
+ print("negative");
+ }
+}
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-ci.0
--- a/tests/usr.bin/indent/opt-ci.0 Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-ci.0 Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,9 @@
-/* $NetBSD: opt-ci.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ci.0,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int
+sum(int a, int b)
+{
+ return a +
+ b;
+}
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-ci.0.stdout
--- a/tests/usr.bin/indent/opt-ci.0.stdout Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-ci.0.stdout Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,9 @@
-/* $NetBSD: opt-ci.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-ci.0.stdout,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int
+sum(int a, int b)
+{
+ return a +
+ b;
+}
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-cli.0
--- a/tests/usr.bin/indent/opt-cli.0 Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-cli.0 Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,14 @@
-/* $NetBSD: opt-cli.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-cli.0,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+classify(int n)
+{
+ switch (n) {
+ case 0: print("zero"); break;
+ case 1: print("one"); break;
+ case 2: case 3: print("prime"); break;
+ case 4: print("square"); break;
+ default: print("large"); break;
+ }
+}
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-cli.0.stdout
--- a/tests/usr.bin/indent/opt-cli.0.stdout Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-cli.0.stdout Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,25 @@
-/* $NetBSD: opt-cli.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-cli.0.stdout,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+void
+classify(int n)
+{
+ switch (n) {
+ case 0:
+ print("zero");
+ break;
+ case 1:
+ print("one");
+ break;
+ case 2:
+ case 3:
+ print("prime");
+ break;
+ case 4:
+ print("square");
+ break;
+ default:
+ print("large");
+ break;
+ }
+}
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-cs.0
--- a/tests/usr.bin/indent/opt-cs.0 Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-cs.0 Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,6 @@
-/* $NetBSD: opt-cs.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-cs.0,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int i0 = (int)3.0;
+int i1 = (int) 3.0;
+int i3 = (int) 3.0;
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-cs.0.stdout
--- a/tests/usr.bin/indent/opt-cs.0.stdout Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-cs.0.stdout Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,6 @@
-/* $NetBSD: opt-cs.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-cs.0.stdout,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int i0 = (int) 3.0;
+int i1 = (int) 3.0;
+int i3 = (int) 3.0;
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-d.0
--- a/tests/usr.bin/indent/opt-d.0 Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-d.0 Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,19 @@
-/* $NetBSD: opt-d.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-d.0,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* XXX: oops, the comments at level 0 move below the '{' */
+void
+example(void)
+/* comment at level 0 */
+ /* comment at level 0 */
+{
+/* comment at level 1 */
+ /* comment at level 1 */
+ /* comment at level 1 */
+ {
+/* comment at level 2 */
+ /* comment at level 2 */
+ /* comment at level 2 */
+ /* comment at level 2 */
+ }
+}
diff -r 3225282875b9 -r f2983783828a tests/usr.bin/indent/opt-d.0.stdout
--- a/tests/usr.bin/indent/opt-d.0.stdout Sat Mar 06 21:08:08 2021 +0000
+++ b/tests/usr.bin/indent/opt-d.0.stdout Sat Mar 06 21:27:39 2021 +0000
@@ -1,4 +1,19 @@
-/* $NetBSD: opt-d.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-d.0.stdout,v 1.2 2021/03/06 21:27:39 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/* XXX: oops, the comments at level 0 move below the '{' */
+void
+example(void)
+{
+/* comment at level 0 */
+/* comment at level 0 */
+/* comment at level 1 */
+/* comment at level 1 */
+/* comment at level 1 */
+ {
Home |
Main Index |
Thread Index |
Old Index