tests/indent: demonstrate wrong spacing in for loops

This commit is contained in:
rillig 2023-05-15 08:22:23 +00:00
parent dca2e8fb00
commit f382e6fe26
1 changed files with 25 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: psym_for_exprs.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
/* $NetBSD: psym_for_exprs.c,v 1.5 2023/05/15 08:22:23 rillig Exp $ */
/*
* Tests for the parser state psym_for_exprs, which represents the state after
@ -7,10 +7,31 @@
*/
//indent input
// TODO: add input
void
for_loops(void)
{
for (int i = 0; i < 10; i++)
printf("%d * %d = %d\n", i, 7, i * 7);
for (int i = 0; i < 10; i++) {
printf("%d * %d = %d\n", i, 7, i * 7);
}
}
//indent end
//indent run-equals-input
//indent run
void
for_loops(void)
{
for (int i = 0; i < 10; i++)
printf("%d * %d = %d\n", i, 7, i * 7);
/* $ FIXME: Add space between ')' and '{'. */
for (int i = 0; i < 10; i++){
printf("%d * %d = %d\n", i, 7, i * 7);
}
}
//indent end
/*
@ -19,7 +40,7 @@
*/
//indent input
void
function(void)
small_scope(void)
{
for (int i = 0; i < 3; i++)
stmt();