Module Name: src
Committed By: rillig
Date: Sat Feb 12 13:38:29 UTC 2022
Modified Files:
src/tests/usr.bin/indent: lsym_typedef.c
Log Message:
tests/indent: demonstrate wrong formatting of enum (since 2019-04-04)
Reported by me in PR#55453.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/lsym_typedef.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/lsym_typedef.c
diff -u src/tests/usr.bin/indent/lsym_typedef.c:1.1 src/tests/usr.bin/indent/lsym_typedef.c:1.2
--- src/tests/usr.bin/indent/lsym_typedef.c:1.1 Thu Nov 18 21:19:19 2021
+++ src/tests/usr.bin/indent/lsym_typedef.c Sat Feb 12 13:38:29 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_typedef.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
+/* $NetBSD: lsym_typedef.c,v 1.2 2022/02/12 13:38:29 rillig Exp $ */
/* $FreeBSD$ */
/*
@@ -6,8 +6,46 @@
* for giving a type an additional name.
*/
+/*
+ * Since 2019-04-04, indent places all enum constants except the first in the
+ * wrong column, but only if the enum declaration follows a 'typedef'.
+ *
+ * https://gnats.netbsd.org/55453
+ */
#indent input
-// TODO: add input
+typedef enum {
+ TC1,
+ TC2
+} T;
+
+enum {
+ EC1,
+ EC2
+} E;
+#indent end
+
+/* FIXME: TC2 is indented too far. */
+#indent run -ci4 -i4
+typedef enum {
+ TC1,
+ TC2
+} T;
+
+enum {
+ EC1,
+ EC2
+} E;
#indent end
-#indent run-equals-input
+/* FIXME: TC2 is indented too far. */
+#indent run -ci2
+typedef enum {
+ TC1,
+ TC2
+} T;
+
+enum {
+ EC1,
+ EC2
+} E;
+#indent end