tests/indent: demonstrate bugs when formatting preprocessing lines

This commit is contained in:
rillig 2023-06-02 11:26:21 +00:00
parent eba8370ebe
commit 7511320300
1 changed files with 35 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: opt_bc.c,v 1.6 2022/04/24 09:04:12 rillig Exp $ */ /* $NetBSD: opt_bc.c,v 1.7 2023/06/02 11:26:21 rillig Exp $ */
/* /*
* Tests for the options '-bc' and '-nbc'. * Tests for the options '-bc' and '-nbc'.
@ -63,3 +63,37 @@ double a, b, c;
return a + b + c; return a + b + c;
} }
//indent end //indent end
//indent input
int a,
#if 0
b, c; int d;
#else
b, c; int d;
#endif
//indent end
//indent run -bc
int a,
#if 0
b,
c;
int d;
#else
// $ FIXME: The '#else' branch must be indented like the '#if' branch.
b, c;
int d;
#endif
//indent end
//indent run -nbc
int a,
// $ FIXME: 'b, c' must not be merged into the preprocessing line.
#if 0 b, c;
int d;
#else
b, c;
int d;
#endif
//indent end