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 test for sizeof and o...



details:   https://anonhg.NetBSD.org/src/rev/15e507b6bc41
branches:  trunk
changeset: 990030:15e507b6bc41
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 24 11:31:37 2021 +0000

description:
tests/indent: add test for sizeof and offsetof with -pcs

diffstat:

 tests/usr.bin/indent/opt_pcs.c |  39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diffs (50 lines):

diff -r 991df397131b -r 15e507b6bc41 tests/usr.bin/indent/opt_pcs.c
--- a/tests/usr.bin/indent/opt_pcs.c    Sun Oct 24 11:19:25 2021 +0000
+++ b/tests/usr.bin/indent/opt_pcs.c    Sun Oct 24 11:31:37 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_pcs.c,v 1.3 2021/10/16 21:32:10 rillig Exp $ */
+/* $NetBSD: opt_pcs.c,v 1.4 2021/10/24 11:31:37 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -40,3 +40,40 @@
        function_call(1, 2, 3);
 }
 #indent end
+
+/*
+ * The option '-pcs' also applies to 'sizeof' and 'offsetof', even though
+ * these are not functions.
+ */
+#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



Home | Main Index | Thread Index | Old Index