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: demonstrate wrong formatt...



details:   https://anonhg.NetBSD.org/src/rev/e9a73983ede3
branches:  trunk
changeset: 361149:e9a73983ede3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Feb 12 13:38:29 2022 +0000

description:
tests/indent: demonstrate wrong formatting of enum (since 2019-04-04)

Reported by me in PR#55453.

diffstat:

 tests/usr.bin/indent/lsym_typedef.c |  44 ++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 3 deletions(-)

diffs (58 lines):

diff -r 5cbd3819995c -r e9a73983ede3 tests/usr.bin/indent/lsym_typedef.c
--- a/tests/usr.bin/indent/lsym_typedef.c       Sat Feb 12 13:17:57 2022 +0000
+++ b/tests/usr.bin/indent/lsym_typedef.c       Sat Feb 12 13:38:29 2022 +0000
@@ -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
 
-#indent run-equals-input
+/* FIXME: TC2 is indented too far. */
+#indent run -ci4 -i4
+typedef enum {
+    TC1,
+       TC2
+} T;
+
+enum {
+    EC1,
+    EC2
+}              E;
+#indent end
+
+/* FIXME: TC2 is indented too far. */
+#indent run -ci2
+typedef enum {
+       TC1,
+         TC2
+} T;
+
+enum {
+       EC1,
+       EC2
+}              E;
+#indent end



Home | Main Index | Thread Index | Old Index