tests/indent: test compound expressions

This commit is contained in:
rillig 2023-12-03 14:26:10 +00:00
parent 5f975974aa
commit 0fde876303
1 changed files with 26 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fmt_expr.c,v 1.10 2023/06/16 23:19:01 rillig Exp $ */
/* $NetBSD: fmt_expr.c,v 1.11 2023/12/03 14:26:10 rillig Exp $ */
/*
* Tests for all kinds of expressions that are not directly related to unary
@ -57,3 +57,28 @@
// error: Standard Input:7: Unbalanced parentheses
// warning: Standard Input:9: Extra ')'
//indent end
// A compound expression with an unknown type is indented other than one with
// a known type. Ideally, both cases should be treated the same.
//indent input
{
var = (type) { .member = value };
var = (type) { value, value, value };
var = (struct s) { .member = value };
var = (struct s) { value, value, value };
}
//indent end
//indent run
{
var = (type) {
.member = value
};
var = (type) {
value, value, value
};
var = (struct s){.member = value};
var = (struct s){value, value, value};
}
//indent end