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 formatting of the to...



details:   https://anonhg.NetBSD.org/src/rev/c1aa15f4d31f
branches:  trunk
changeset: 988672:c1aa15f4d31f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 08 23:04:02 2021 +0000

description:
tests/indent: test formatting of the token ':'

diffstat:

 tests/usr.bin/indent/token-colon.0        |  21 +++++++++++++++++++--
 tests/usr.bin/indent/token-colon.0.stdout |  28 ++++++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 4 deletions(-)

diffs (71 lines):

diff -r 7a408e60242a -r c1aa15f4d31f tests/usr.bin/indent/token-colon.0
--- a/tests/usr.bin/indent/token-colon.0        Fri Oct 08 22:37:33 2021 +0000
+++ b/tests/usr.bin/indent/token-colon.0        Fri Oct 08 23:04:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: token-colon.0,v 1.1 2021/03/12 00:13:06 rillig Exp $ */
+/* $NetBSD: token-colon.0,v 1.2 2021/10/08 23:04:02 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -14,4 +14,21 @@
  * In the declaration of a struct member that is a bit-field.
  */
 
-/* TODO: Add some code to be formatted. */
+void endless(void)
+{
+label1:
+goto label2;
+
+    if (true)if (true)if (true)if (true)label2 :goto label1;
+}
+
+int constant_expression = true?4:12345;
+
+struct bit_field {
+bool flag:1;
+int maybe_signed : 4;
+signed int definitely_signed:3;
+signed int : 0;/* finish the storage unit for the bit-field */
+unsigned int definitely_unsigned:3;
+unsigned int:0;/* finish the storage unit for the bit-field */
+};
diff -r 7a408e60242a -r c1aa15f4d31f tests/usr.bin/indent/token-colon.0.stdout
--- a/tests/usr.bin/indent/token-colon.0.stdout Fri Oct 08 22:37:33 2021 +0000
+++ b/tests/usr.bin/indent/token-colon.0.stdout Fri Oct 08 23:04:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: token-colon.0.stdout,v 1.1 2021/03/12 00:13:06 rillig Exp $ */
+/* $NetBSD: token-colon.0.stdout,v 1.2 2021/10/08 23:04:02 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -14,4 +14,28 @@
  * In the declaration of a struct member that is a bit-field.
  */
 
-/* TODO: Add some code to be formatted. */
+void
+endless(void)
+{
+label1:
+       goto label2;
+
+       if (true)
+               if (true)
+                       if (true)
+                               if (true)
+                       label2:         goto label1;
+}
+
+int            constant_expression = true ? 4 : 12345;
+
+struct bit_field {
+       bool            flag:1;
+       int             maybe_signed:4;
+       signed int      definitely_signed:3;
+/* $ XXX: Placing the colon directly at the type looks inconsistent. */
+       signed int:     0;      /* finish the storage unit for the bit-field */
+       unsigned int    definitely_unsigned:3;
+/* $ XXX: Placing the colon directly at the type looks inconsistent. */
+       unsigned int:   0;      /* finish the storage unit for the bit-field */
+};



Home | Main Index | Thread Index | Old Index