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: add test for preprocessor...



details:   https://anonhg.NetBSD.org/src/rev/11cf1f54a542
branches:  trunk
changeset: 960245:11cf1f54a542
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Mar 12 22:53:18 2021 +0000

description:
tests/indent: add test for preprocessor lines

diffstat:

 tests/usr.bin/indent/token-preprocessing.0        |  19 +++++++++++++++++--
 tests/usr.bin/indent/token-preprocessing.0.stdout |  20 ++++++++++++++++++--
 2 files changed, 35 insertions(+), 4 deletions(-)

diffs (61 lines):

diff -r 6eaa8cc84a59 -r 11cf1f54a542 tests/usr.bin/indent/token-preprocessing.0
--- a/tests/usr.bin/indent/token-preprocessing.0        Fri Mar 12 21:07:08 2021 +0000
+++ b/tests/usr.bin/indent/token-preprocessing.0        Fri Mar 12 22:53:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: token-preprocessing.0,v 1.1 2021/03/12 00:13:06 rillig Exp $ */
+/* $NetBSD: token-preprocessing.0,v 1.2 2021/03/12 22:53:18 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*-
@@ -10,4 +10,19 @@
  * #line
  */
 
-/* TODO: Add some code to be formatted. */
+#include <system-header.h>
+#include "local-header.h"
+
+#if 0
+#else
+#endif
+
+#if 0 /* if comment */
+#else /* else comment */
+#endif /* endif comment */
+
+#if 0 /* outer if comment */
+#  if nested /* inner if comment */
+#  else /* inner else comment */
+#  endif /* inner endif comment */
+#endif /* outer endif comment */
diff -r 6eaa8cc84a59 -r 11cf1f54a542 tests/usr.bin/indent/token-preprocessing.0.stdout
--- a/tests/usr.bin/indent/token-preprocessing.0.stdout Fri Mar 12 21:07:08 2021 +0000
+++ b/tests/usr.bin/indent/token-preprocessing.0.stdout Fri Mar 12 22:53:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: token-preprocessing.0.stdout,v 1.1 2021/03/12 00:13:06 rillig Exp $ */
+/* $NetBSD: token-preprocessing.0.stdout,v 1.2 2021/03/12 22:53:18 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*-
@@ -10,4 +10,20 @@
  * #line
  */
 
-/* TODO: Add some code to be formatted. */
+#include <system-header.h>
+#include "local-header.h"
+
+#if 0
+#else
+#endif
+
+#if 0                          /* if comment */
+#else                          /* else comment */
+#endif                         /* endif comment */
+
+#if 0                          /* outer if comment */
+/* $ XXX: The indentation is removed, which can get confusing */
+#if nested                     /* inner if comment */
+#else                          /* inner else comment */
+#endif                         /* inner endif comment */
+#endif                         /* outer endif comment */



Home | Main Index | Thread Index | Old Index