From 1dea3928a2e04d6acc7a43341fb54f36ddfcdc18 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Sat, 31 Jul 2021 13:17:14 -0400 Subject: add compound_lit.c test --- tests/indent/c/compound_lit.c | 10 ++++++++++ tests/indent/c_spec.lua | 1 + 2 files changed, 11 insertions(+) create mode 100644 tests/indent/c/compound_lit.c diff --git a/tests/indent/c/compound_lit.c b/tests/indent/c/compound_lit.c new file mode 100644 index 000000000..29e336f58 --- /dev/null +++ b/tests/indent/c/compound_lit.c @@ -0,0 +1,10 @@ +struct foo { + int x, y; +}; + +struct foo bar(int x, int y) { + return (struct foo) { + .x = x, + .y = y + }; +} diff --git a/tests/indent/c_spec.lua b/tests/indent/c_spec.lua index f48cbd0aa..1bdd01655 100644 --- a/tests/indent/c_spec.lua +++ b/tests/indent/c_spec.lua @@ -14,6 +14,7 @@ describe("indent C:", function() describe("new line:", function() runner:new_line("array.c", { on_line = 2, text = "0,", indent = 4 }) + runner:new_line("compound_lit.c", { on_line = 7, text = ".z = 5,", indent = 8 }) runner:new_line("cond.c", { on_line = 3, text = "x++;", indent = 8 }) runner:new_line("cond.c", { on_line = 8, text = "x++;", indent = 8 }) runner:new_line("expr.c", { on_line = 10, text = "2 *", indent = 8 }) -- cgit v1.2.3-70-g09d2