diff options
| author | rillig <rillig@NetBSD.org> | 2023-06-26 14:54:40 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2023-06-26 14:54:40 +0000 |
| commit | a8f0f20434af349eca3c46f9e2b1e6be86012f98 (patch) | |
| tree | 2891dadd04b087aa62948282b0371fc8787badea /tests | |
| parent | f0dd025e4295159d0e9c2b3449e94d3ae1d01306 (diff) | |
indent: in -bad mode, don't add a blank line above a comment or '}'
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/usr.bin/indent/opt_bad.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/tests/usr.bin/indent/opt_bad.c b/tests/usr.bin/indent/opt_bad.c index 896d10c8712..51692f37ad4 100644 --- a/tests/usr.bin/indent/opt_bad.c +++ b/tests/usr.bin/indent/opt_bad.c @@ -1,4 +1,4 @@ -/* $NetBSD: opt_bad.c,v 1.11 2023/06/17 22:09:24 rillig Exp $ */ +/* $NetBSD: opt_bad.c,v 1.12 2023/06/26 14:54:40 rillig Exp $ */ /* * Tests for the options '-bad' and '-nbad'. @@ -12,14 +12,6 @@ /* Test global declarations. */ //indent input -int global_variable; -void function_declaration(void); -#if 0 -#endif -/* comment */ -//indent end - -//indent run -bad int global_variable; void function_declaration(void); #if 0 @@ -27,7 +19,9 @@ void function_declaration(void); /* comment */ //indent end -//indent run-equals-prev-output -nbad +//indent run-equals-input -bad + +//indent run-equals-input -nbad /* See FreeBSD r303599. */ @@ -110,8 +104,10 @@ comments(void) { int local_var_1; /* comment */ int local_var_2; /* comment */ - +// $ Indent does not look ahead much, so it doesn't know whether this comment +// $ will be followed by a declaration or a statement. /* comment line */ + function_call(); } //indent end @@ -169,20 +165,17 @@ initializer_with_blank(void) //indent input { - int decl; + // $ The '}' in an initializer does not finish a declaration, + // $ only a semicolon does. + int decl1[2][2] = { + {1, 2}, + {3, 4}, + }; /* comment */ - int decl; + int decl2; + // $ If the declaration is followed by a '}' that terminates the block + // $ statement, * there is no need for a blank line before the '}'. } //indent end -//indent run -bad -di0 -{ - int decl; -// $ FIXME: This blank line is _between_ the declarations, not _after_ them. - - /* comment */ - int decl; -// $ XXX: This blank line is unnecessary, it doesn't occur in practice, though. - -} -//indent end +//indent run-equals-input -bad -di0 |
