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 more tests, from inde...



details:   https://anonhg.NetBSD.org/src/rev/b29e86bcc830
branches:  trunk
changeset: 376271:b29e86bcc830
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jun 08 20:49:04 2023 +0000

description:
tests/indent: add more tests, from indent's own code

diffstat:

 tests/usr.bin/indent/lsym_lparen_or_lbracket.c |  18 +++++++++++++++++-
 tests/usr.bin/indent/lsym_unary_op.c           |   8 +++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diffs (57 lines):

diff -r fa6522b36cad -r b29e86bcc830 tests/usr.bin/indent/lsym_lparen_or_lbracket.c
--- a/tests/usr.bin/indent/lsym_lparen_or_lbracket.c    Thu Jun 08 20:36:35 2023 +0000
+++ b/tests/usr.bin/indent/lsym_lparen_or_lbracket.c    Thu Jun 08 20:49:04 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.13 2023/06/04 18:58:30 rillig Exp $ */
+/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.14 2023/06/08 20:49:04 rillig Exp $ */
 
 /*
  * Tests for the token lsym_lparen_or_lbracket, which represents a '(' or '['
@@ -336,3 +336,19 @@ cover_want_blank_before_lparen(void)
 //indent end
 
 /* See t_errors.sh, test case 'compound_literal'. */
+
+
+//indent input
+int arr[] = {
+['0'] = 1,
+['1'] = 2,
+};
+//indent end
+
+//indent run -di0
+int arr[] = {
+       ['0'] = 1,
+// $ FIXME: 1 space extra indentation.
+        ['1'] = 2,
+};
+//indent end
diff -r fa6522b36cad -r b29e86bcc830 tests/usr.bin/indent/lsym_unary_op.c
--- a/tests/usr.bin/indent/lsym_unary_op.c      Thu Jun 08 20:36:35 2023 +0000
+++ b/tests/usr.bin/indent/lsym_unary_op.c      Thu Jun 08 20:49:04 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_unary_op.c,v 1.8 2023/06/02 14:21:55 rillig Exp $ */
+/* $NetBSD: lsym_unary_op.c,v 1.9 2023/06/08 20:49:04 rillig Exp $ */
 
 /*
  * Tests for the token lsym_unary_op, which represents a unary operator.
@@ -82,6 +82,8 @@ unary_operators(void)
 //indent input
 {
 sbuf_t *sb = *(sbuf_t **)sp;
+return (int)(a * (float)b);
+a = (2 * b == c);
 }
 //indent end
 
@@ -89,5 +91,9 @@ sbuf_t *sb = *(sbuf_t **)sp;
 {
 // $ FIXME: Wrong spacing after the cast.
        sbuf_t *sb = *(sbuf_t **) sp;
+// $ FIXME: Wrong spacing after the '*'.
+       return (int)(a *(float)b);
+// $ FIXME: Wrong spacing after the '*'.
+       a = (2 *b == c);
 }
 //indent end



Home | Main Index | Thread Index | Old Index