Module Name: src Committed By: rillig Date: Sun Dec 3 14:26:10 UTC 2023
Modified Files: src/tests/usr.bin/indent: fmt_expr.c Log Message: tests/indent: test compound expressions To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/fmt_expr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/indent/fmt_expr.c diff -u src/tests/usr.bin/indent/fmt_expr.c:1.10 src/tests/usr.bin/indent/fmt_expr.c:1.11 --- src/tests/usr.bin/indent/fmt_expr.c:1.10 Fri Jun 16 23:19:01 2023 +++ src/tests/usr.bin/indent/fmt_expr.c Sun Dec 3 14:26:10 2023 @@ -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