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: test interaction between ...



details:   https://anonhg.NetBSD.org/src/rev/af6b31614187
branches:  trunk
changeset: 1024447:af6b31614187
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 24 11:42:57 2021 +0000

description:
tests/indent: test interaction between -pcs and -bs

diffstat:

 tests/usr.bin/indent/opt_bs.c  |  39 ++++++++++++++++++++++++++++++++++++++-
 tests/usr.bin/indent/opt_pcs.c |  20 ++++++++++++++++++--
 2 files changed, 56 insertions(+), 3 deletions(-)

diffs (91 lines):

diff -r b4949b5e9efb -r af6b31614187 tests/usr.bin/indent/opt_bs.c
--- a/tests/usr.bin/indent/opt_bs.c     Sun Oct 24 11:31:37 2021 +0000
+++ b/tests/usr.bin/indent/opt_bs.c     Sun Oct 24 11:42:57 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bs.c,v 1.3 2021/10/16 21:32:10 rillig Exp $ */
+/* $NetBSD: opt_bs.c,v 1.4 2021/10/24 11:42:57 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -60,3 +60,40 @@
        print(sizeof(int));
 }
 #indent end
+
+/*
+ * The option '-bs' only affects 'sizeof', not 'offsetof', even though these
+ * two keywords are syntactically similar.
+ */
+#indent input
+int sizeof_type = sizeof   (int);
+int sizeof_type = sizeof(int);
+int sizeof_expr = sizeof   (0);
+int sizeof_expr = sizeof(0);
+int sizeof_expr = sizeof   0;
+
+int offset = offsetof(struct s, member);
+int offset = offsetof   (struct s, member);
+#indent end
+
+#indent run -pcs -di0
+int sizeof_type = sizeof (int);
+int sizeof_type = sizeof (int);
+int sizeof_expr = sizeof (0);
+int sizeof_expr = sizeof (0);
+int sizeof_expr = sizeof 0;
+
+int offset = offsetof (struct s, member);
+int offset = offsetof (struct s, member);
+#indent end
+
+#indent run -npcs -di0
+int sizeof_type = sizeof(int);
+int sizeof_type = sizeof(int);
+int sizeof_expr = sizeof(0);
+int sizeof_expr = sizeof(0);
+int sizeof_expr = sizeof 0;
+
+int offset = offsetof(struct s, member);
+int offset = offsetof(struct s, member);
+#indent end
diff -r b4949b5e9efb -r af6b31614187 tests/usr.bin/indent/opt_pcs.c
--- a/tests/usr.bin/indent/opt_pcs.c    Sun Oct 24 11:31:37 2021 +0000
+++ b/tests/usr.bin/indent/opt_pcs.c    Sun Oct 24 11:42:57 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_pcs.c,v 1.4 2021/10/24 11:31:37 rillig Exp $ */
+/* $NetBSD: opt_pcs.c,v 1.5 2021/10/24 11:42:57 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -56,7 +56,8 @@
 int offset = offsetof   (struct s, member);
 #indent end
 
-#indent run -pcs -di0
+/* The option '-pcs' overrides '-nbs'. */
+#indent run -pcs -di0 -nbs
 int sizeof_type = sizeof (int);
 int sizeof_type = sizeof (int);
 int sizeof_expr = sizeof (0);
@@ -67,6 +68,21 @@
 int offset = offsetof (struct s, member);
 #indent end
 
+/*
+ * If the option '-npcs' is given, '-bs' can still specialize it. This only
+ * applies to 'sizeof', but not 'offsetof'.
+ */
+#indent run -npcs -di0 -bs
+int sizeof_type = sizeof (int);
+int sizeof_type = sizeof (int);
+int sizeof_expr = sizeof (0);
+int sizeof_expr = sizeof (0);
+int sizeof_expr = sizeof 0;
+
+int offset = offsetof(struct s, member);
+int offset = offsetof(struct s, member);
+#indent end
+
 #indent run -npcs -di0
 int sizeof_type = sizeof(int);
 int sizeof_type = sizeof(int);



Home | Main Index | Thread Index | Old Index