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: document that label inden...



details:   https://anonhg.NetBSD.org/src/rev/012087b988cd
branches:  trunk
changeset: 1023845:012087b988cd
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Sep 27 19:02:44 2021 +0000

description:
tests/indent: document that label indentation is not configurable

For at least the past 27 years, labels have been indented 2 levels to
the left of the corresponding statement. See label_offset and
compute_label_indent (or compute_label_target in FreeBSD).

diffstat:

 tests/usr.bin/indent/label.0        |  32 +++++++++++++++++++++++++++++++-
 tests/usr.bin/indent/label.0.stdout |  32 +++++++++++++++++++++++++++++++-
 2 files changed, 62 insertions(+), 2 deletions(-)

diffs (86 lines):

diff -r 8971871b99d6 -r 012087b988cd tests/usr.bin/indent/label.0
--- a/tests/usr.bin/indent/label.0      Mon Sep 27 18:21:47 2021 +0000
+++ b/tests/usr.bin/indent/label.0      Mon Sep 27 19:02:44 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.0,v 1.1 2019/04/04 15:27:35 kamil Exp $  */
+/*     $NetBSD: label.0,v 1.2 2021/09/27 19:02:44 rillig Exp $ */
 /* $FreeBSD: head/usr.bin/indent/tests/label.0 313544 2017-02-10 09:31:39Z pstef $ */
 /* See r303489 */
 void t(void) {
@@ -12,3 +12,33 @@
 V: ;
 U: ;
 }
+
+/*
+ * The indentation of statement labels is fixed to -2, it is not configurable.
+ */
+void
+label_indentation(void)
+{
+       if (level1) {
+       if (level2) {
+       if (level3) {
+       if (level4) {
+       if (level5) {
+       label5:
+       statement();
+       }
+       label4:
+       statement();
+       }
+       label3:
+       statement();
+       }
+       label2:
+       statement();
+       }
+       label1:
+       statement();
+       }
+       label0:
+       statement();
+}
diff -r 8971871b99d6 -r 012087b988cd tests/usr.bin/indent/label.0.stdout
--- a/tests/usr.bin/indent/label.0.stdout       Mon Sep 27 18:21:47 2021 +0000
+++ b/tests/usr.bin/indent/label.0.stdout       Mon Sep 27 19:02:44 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.0.stdout,v 1.1 2019/04/04 15:27:35 kamil Exp $   */
+/*     $NetBSD: label.0.stdout,v 1.2 2021/09/27 19:02:44 rillig Exp $  */
 /* $FreeBSD: head/usr.bin/indent/tests/label.0.stdout 321381 2017-07-23 14:04:45Z pstef $ */
 /* See r303489 */
 void
@@ -13,3 +13,33 @@
 V:      ;
 U:      ;
 }
+
+/*
+ * The indentation of statement labels is fixed to -2, it is not configurable.
+ */
+void
+label_indentation(void)
+{
+        if (level1) {
+                if (level2) {
+                        if (level3) {
+                                if (level4) {
+                                        if (level5) {
+                                label5:
+                                                statement();
+                                        }
+                        label4:
+                                        statement();
+                                }
+                label3:
+                                statement();
+                        }
+        label2:
+                        statement();
+                }
+label1:
+                statement();
+        }
+label0:
+        statement();
+}



Home | Main Index | Thread Index | Old Index