Module Name:    src
Committed By:   rillig
Date:           Thu Jun  8 20:49:04 UTC 2023

Modified Files:
        src/tests/usr.bin/indent: lsym_lparen_or_lbracket.c lsym_unary_op.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/lsym_unary_op.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c
diff -u src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.13 src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.14
--- src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.13	Sun Jun  4 18:58:30 2023
+++ src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c	Thu Jun  8 20:49:04 2023
@@ -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

Index: src/tests/usr.bin/indent/lsym_unary_op.c
diff -u src/tests/usr.bin/indent/lsym_unary_op.c:1.8 src/tests/usr.bin/indent/lsym_unary_op.c:1.9
--- src/tests/usr.bin/indent/lsym_unary_op.c:1.8	Fri Jun  2 14:21:55 2023
+++ src/tests/usr.bin/indent/lsym_unary_op.c	Thu Jun  8 20:49:04 2023
@@ -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

Reply via email to