diff --git a/tests/usr.bin/indent/fmt_decl.c b/tests/usr.bin/indent/fmt_decl.c index 8952fc1a6b1f..a516005b836c 100644 --- a/tests/usr.bin/indent/fmt_decl.c +++ b/tests/usr.bin/indent/fmt_decl.c @@ -1,4 +1,4 @@ -/* $NetBSD: fmt_decl.c,v 1.53 2023/06/10 06:38:21 rillig Exp $ */ +/* $NetBSD: fmt_decl.c,v 1.54 2023/06/10 17:56:29 rillig Exp $ */ /* * Tests for declarations of global variables, external functions, and local @@ -1069,3 +1069,19 @@ b[] = {1, 2}; b[] = {1, 2}; } //indent end + + +/* + * When a type occurs at the top level, it forces a line break before. + */ +//indent input +__attribute__((__dead__)) void die(void) {} +//indent end + +//indent run +__attribute__((__dead__)) +void +die(void) +{ +} +//indent end diff --git a/tests/usr.bin/indent/psym_if_expr.c b/tests/usr.bin/indent/psym_if_expr.c index f052dfb584ec..fc2f06da1c82 100644 --- a/tests/usr.bin/indent/psym_if_expr.c +++ b/tests/usr.bin/indent/psym_if_expr.c @@ -1,4 +1,4 @@ -/* $NetBSD: psym_if_expr.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */ +/* $NetBSD: psym_if_expr.c,v 1.5 2023/06/10 17:56:29 rillig Exp $ */ /* * Tests for the parser symbol psym_if_expr, representing the parser state @@ -20,3 +20,27 @@ function(void) stmt(); } //indent end + + +/* + * Indent is forgiving about syntax errors such as an 'if' statement in which + * the condition is not parenthesized. + */ +//indent input +{ + if cond { + } + if cond && cond { + } +} +//indent end + +//indent run +{ + if cond { + } + if cond + && cond { + } +} +//indent end