Module Name:    src
Committed By:   rillig
Date:           Sun Nov  7 15:44:28 UTC 2021

Modified Files:
        src/tests/usr.bin/indent: opt_cs.c opt_v.c
            token_keyword_struct_union_enum.c

Log Message:
tests/indent: test cast, line counting, comment in struct


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/opt_cs.c \
    src/tests/usr.bin/indent/opt_v.c
cvs rdiff -u -r1.2 -r1.3 \
    src/tests/usr.bin/indent/token_keyword_struct_union_enum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/indent/opt_cs.c
diff -u src/tests/usr.bin/indent/opt_cs.c:1.3 src/tests/usr.bin/indent/opt_cs.c:1.4
--- src/tests/usr.bin/indent/opt_cs.c:1.3	Sat Oct 16 21:32:10 2021
+++ src/tests/usr.bin/indent/opt_cs.c	Sun Nov  7 15:44:28 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_cs.c,v 1.3 2021/10/16 21:32:10 rillig Exp $ */
+/* $NetBSD: opt_cs.c,v 1.4 2021/11/07 15:44:28 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -26,3 +26,25 @@ int		i0 = (int)3.0;
 int		i1 = (int)3.0;
 int		i3 = (int)3.0;
 #indent end
+
+
+#indent input
+struct s	s3 = (struct s)   s;
+struct s       *ptr = (struct s *)   s;
+union u		u3 = (union u)   u;
+enum e		e3 = (enum e)   e;
+#indent end
+
+#indent run -cs
+struct s	s3 = (struct s) s;
+struct s       *ptr = (struct s *) s;
+union u		u3 = (union u) u;
+enum e		e3 = (enum e) e;
+#indent end
+
+#indent run -ncs
+struct s	s3 = (struct s)s;
+struct s       *ptr = (struct s *)s;
+union u		u3 = (union u)u;
+enum e		e3 = (enum e)e;
+#indent end
Index: src/tests/usr.bin/indent/opt_v.c
diff -u src/tests/usr.bin/indent/opt_v.c:1.3 src/tests/usr.bin/indent/opt_v.c:1.4
--- src/tests/usr.bin/indent/opt_v.c:1.3	Fri Oct 22 19:27:53 2021
+++ src/tests/usr.bin/indent/opt_v.c	Sun Nov  7 15:44:28 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_v.c,v 1.3 2021/10/22 19:27:53 rillig Exp $ */
+/* $NetBSD: opt_v.c,v 1.4 2021/11/07 15:44:28 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -90,3 +90,33 @@ There were 5 output lines and 1 comments
  * XXX: It's rather strange that -v writes to stdout, even in filter mode.
  * This output belongs on stderr instead.
  */
+
+
+/*
+ * Test line counting in preprocessor directives.
+ */
+#indent input
+#if 0
+int line = 1;
+int line = 2;
+int line = 3;
+#else
+int line = 5;
+#endif
+#indent end
+
+#indent run -v -di0
+#if 0
+int line = 1;
+int line = 2;
+int line = 3;
+#else
+int line = 5;
+#endif
+There were 3 output lines and 0 comments
+(Lines with comments)/(Lines with code):  0.000
+#indent end
+/*
+ * FIXME: The lines within the conditional compilation directives must be
+ * counted as well. TODO: Move stats out of parser_state.
+ */

Index: src/tests/usr.bin/indent/token_keyword_struct_union_enum.c
diff -u src/tests/usr.bin/indent/token_keyword_struct_union_enum.c:1.2 src/tests/usr.bin/indent/token_keyword_struct_union_enum.c:1.3
--- src/tests/usr.bin/indent/token_keyword_struct_union_enum.c:1.2	Fri Oct 22 19:46:41 2021
+++ src/tests/usr.bin/indent/token_keyword_struct_union_enum.c	Sun Nov  7 15:44:28 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token_keyword_struct_union_enum.c,v 1.2 2021/10/22 19:46:41 rillig Exp $ */
+/* $NetBSD: token_keyword_struct_union_enum.c,v 1.3 2021/11/07 15:44:28 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -68,3 +68,13 @@ u(struct x a)
 	struct y	c = (struct y *)&a;
 }
 #indent end
+
+
+/* Comment between 'struct' and the tag name; doesn't occur in practice. */
+#indent input
+struct   /* comment */   tag var;
+#indent end
+
+#indent run -di0
+struct /* comment */ tag var;
+#indent end

Reply via email to