tests/indent: add move coverage tests

This commit is contained in:
rillig 2023-06-10 17:56:29 +00:00
parent 8bcc07836b
commit 3d124ccbbf
2 changed files with 42 additions and 2 deletions

View File

@ -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

View File

@ -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