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 edge ca...



details:   https://anonhg.NetBSD.org/src/rev/807dc3a9594f
branches:  trunk
changeset: 1024784:807dc3a9594f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Nov 04 18:31:22 2021 +0000

description:
tests/indent: demonstrate wrong edge case in C99 comments

diffstat:

 tests/usr.bin/indent/token_comment.c |  19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 14e5aeda79b0 -r 807dc3a9594f tests/usr.bin/indent/token_comment.c
--- a/tests/usr.bin/indent/token_comment.c      Thu Nov 04 17:37:03 2021 +0000
+++ b/tests/usr.bin/indent/token_comment.c      Thu Nov 04 18:31:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: token_comment.c,v 1.15 2021/10/30 22:36:07 rillig Exp $ */
+/* $NetBSD: token_comment.c,v 1.16 2021/11/04 18:31:22 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -948,3 +948,20 @@
                 /* 12 1234 123 123456 1234 1234567 123 1234.  */ ;
 }
 #indent end
+
+
+/*
+ * Test for an edge cases in comment handling, having a block comment inside
+ * a line comment.
+ */
+#indent input
+/* block comment */
+// line comment /* still a line comment */ still a line comment
+#indent end
+
+/* FIXME: The line comment must not be indented. */
+/* FIXME: The '*' '/' in the line comment must not be removed. */
+#indent run
+/* block comment */
+ // line comment /* still a line comment  still a line comment
+#indent end



Home | Main Index | Thread Index | Old Index