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 tests for negative op...
details: https://anonhg.NetBSD.org/src/rev/01b6f62e1658
branches: trunk
changeset: 953346:01b6f62e1658
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Mar 06 23:09:17 2021 +0000
description:
tests/indent: add tests for negative options
Since most of these options are of the form "don't do anything", the
input and output of these tests is very similar.
diffstat:
tests/usr.bin/indent/opt-nbacc.0 | 19 ++++++++++++-
tests/usr.bin/indent/opt-nbacc.0.stdout | 19 ++++++++++++-
tests/usr.bin/indent/opt-nbad.0 | 13 ++++++++-
tests/usr.bin/indent/opt-nbad.0.stdout | 15 +++++++++-
tests/usr.bin/indent/opt-nbadp.0 | 33 ++++++++++++++++++++++-
tests/usr.bin/indent/opt-nbadp.0.stdout | 33 ++++++++++++++++++++++-
tests/usr.bin/indent/opt-nbap.0 | 21 +++++++++++++-
tests/usr.bin/indent/opt-nbap.0.stdout | 31 +++++++++++++++++++++-
tests/usr.bin/indent/opt-nbbb.0 | 26 +++++++++++++++++-
tests/usr.bin/indent/opt-nbbb.0.stdout | 26 +++++++++++++++++-
tests/usr.bin/indent/opt-nbc.0 | 5 ++-
tests/usr.bin/indent/opt-nbc.0.stdout | 5 ++-
tests/usr.bin/indent/opt-nbs.0 | 17 +++++++++++-
tests/usr.bin/indent/opt-nbs.0.stdout | 17 +++++++++++-
tests/usr.bin/indent/opt-ncdb.0 | 45 +++++++++++++++++++++++++++++++-
tests/usr.bin/indent/opt-ncdb.0.stdout | 27 ++++++++++++++++++-
tests/usr.bin/indent/opt-ncs.0 | 6 ++-
tests/usr.bin/indent/opt-ncs.0.stdout | 6 ++-
tests/usr.bin/indent/opt-ndj.0 | 11 ++++++-
tests/usr.bin/indent/opt-ndj.0.stdout | 11 ++++++-
tests/usr.bin/indent/opt-neei.0 | 14 ++++++++-
tests/usr.bin/indent/opt-neei.0.stdout | 14 ++++++++-
22 files changed, 370 insertions(+), 44 deletions(-)
diffs (truncated from 546 to 300 lines):
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbacc.0
--- a/tests/usr.bin/indent/opt-nbacc.0 Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbacc.0 Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,19 @@
-/* $NetBSD: opt-nbacc.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nbacc.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int a;
+#if 0
+int b;
+#endif
+int c;
+
+
+int space_a;
+
+#if 0
+
+int space_b;
+
+#endif
+
+int space_c;
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbacc.0.stdout
--- a/tests/usr.bin/indent/opt-nbacc.0.stdout Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbacc.0.stdout Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,19 @@
-/* $NetBSD: opt-nbacc.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nbacc.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int a;
+#if 0
+int b;
+#endif
+int c;
+
+
+int space_a;
+
+#if 0
+
+int space_b;
+
+#endif
+
+int space_c;
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbad.0
--- a/tests/usr.bin/indent/opt-nbad.0 Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbad.0 Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,13 @@
-/* $NetBSD: opt-nbad.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nbad.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int global_variable;
+void function_declaration(void);
+#if 0
+#endif
+void function_definition(void) {
+ int local_variable;
+ function_call();
+ int local_variable_after_statement;
+ function_call();
+}
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbad.0.stdout
--- a/tests/usr.bin/indent/opt-nbad.0.stdout Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbad.0.stdout Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,15 @@
-/* $NetBSD: opt-nbad.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nbad.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+int global_variable;
+void function_declaration(void);
+#if 0
+#endif
+void
+function_definition(void)
+{
+ int local_variable;
+ function_call();
+ int local_variable_after_statement;
+ function_call();
+}
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbadp.0
--- a/tests/usr.bin/indent/opt-nbadp.0 Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbadp.0 Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,33 @@
-/* $NetBSD: opt-nbadp.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nbadp.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+static void
+no_declarations(void)
+{
+ action();
+}
+
+static void
+declarations_without_blank_line(void)
+{
+ int local_variable;
+ action();
+}
+
+static void
+declaration_with_blank_line(void)
+{
+ int local_variable;
+
+ action();
+}
+
+static void
+declaration_with_several_blank_lines(void)
+{
+ int local_variable;
+
+
+
+ action();
+}
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbadp.0.stdout
--- a/tests/usr.bin/indent/opt-nbadp.0.stdout Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbadp.0.stdout Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,33 @@
-/* $NetBSD: opt-nbadp.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nbadp.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+static void
+no_declarations(void)
+{
+ action();
+}
+
+static void
+declarations_without_blank_line(void)
+{
+ int local_variable;
+ action();
+}
+
+static void
+declaration_with_blank_line(void)
+{
+ int local_variable;
+
+ action();
+}
+
+static void
+declaration_with_several_blank_lines(void)
+{
+ int local_variable;
+
+
+
+ action();
+}
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbap.0
--- a/tests/usr.bin/indent/opt-nbap.0 Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbap.0 Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,21 @@
-/* $NetBSD: opt-nbap.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nbap.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+static void one_liner(void) {}
+static void several_lines(void) {
+ action();
+}
+int main(void){}
+int global_variable;
+
+void already_has_blank_line_below(void)
+{
+}
+
+void has_several_blank_lines_below(void)
+{
+}
+
+
+
+int the_end;
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbap.0.stdout
--- a/tests/usr.bin/indent/opt-nbap.0.stdout Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbap.0.stdout Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,31 @@
-/* $NetBSD: opt-nbap.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nbap.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+static void
+one_liner(void)
+{
+}
+static void
+several_lines(void)
+{
+ action();
+}
+int
+main(void)
+{
+}
+int global_variable;
+
+void
+already_has_blank_line_below(void)
+{
+}
+
+void
+has_several_blank_lines_below(void)
+{
+}
+
+
+
+int the_end;
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbbb.0
--- a/tests/usr.bin/indent/opt-nbbb.0 Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbbb.0 Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,26 @@
-/* $NetBSD: opt-nbbb.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nbbb.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * This is a block comment.
+ */
+/* This is not a block comment since it is single-line. */
+/*
+ * This is a second block comment.
+ */
+/* This is not a block comment. */
+/*
+ * Documentation of global_variable.
+ */
+int global_variable;
+/*
+ * Documentation of function_declaration.
+ */
+void function_declaration(void);
+/*
+ * Documentation of function_definition.
+ */
+void
+function_definition(void)
+{
+}
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbbb.0.stdout
--- a/tests/usr.bin/indent/opt-nbbb.0.stdout Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbbb.0.stdout Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,26 @@
-/* $NetBSD: opt-nbbb.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */
+/* $NetBSD: opt-nbbb.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */
/* $FreeBSD$ */
-/* TODO: implement the test */
+/*
+ * This is a block comment.
+ */
+/* This is not a block comment since it is single-line. */
+/*
+ * This is a second block comment.
+ */
+/* This is not a block comment. */
+/*
+ * Documentation of global_variable.
+ */
+int global_variable;
+/*
+ * Documentation of function_declaration.
+ */
+void function_declaration(void);
+/*
+ * Documentation of function_definition.
+ */
+void
+function_definition(void)
+{
+}
diff -r c38e4d5a328c -r 01b6f62e1658 tests/usr.bin/indent/opt-nbc.0
--- a/tests/usr.bin/indent/opt-nbc.0 Sat Mar 06 22:10:40 2021 +0000
+++ b/tests/usr.bin/indent/opt-nbc.0 Sat Mar 06 23:09:17 2021 +0000
@@ -1,4 +1,5 @@
Home |
Main Index |
Thread Index |
Old Index