aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorleo60228 <leo@60228.dev>2021-07-31 13:17:14 -0400
committerThomas Vigouroux <tomvig38@gmail.com>2021-08-01 11:01:47 +0200
commit1dea3928a2e04d6acc7a43341fb54f36ddfcdc18 (patch)
tree3b8d52e75e5239ac4713bf58a2579eba9e4e9994 /tests
parentIndent C compound_literal_expression (diff)
downloadnvim-treesitter-1dea3928a2e04d6acc7a43341fb54f36ddfcdc18.tar
nvim-treesitter-1dea3928a2e04d6acc7a43341fb54f36ddfcdc18.tar.gz
nvim-treesitter-1dea3928a2e04d6acc7a43341fb54f36ddfcdc18.tar.bz2
nvim-treesitter-1dea3928a2e04d6acc7a43341fb54f36ddfcdc18.tar.lz
nvim-treesitter-1dea3928a2e04d6acc7a43341fb54f36ddfcdc18.tar.xz
nvim-treesitter-1dea3928a2e04d6acc7a43341fb54f36ddfcdc18.tar.zst
nvim-treesitter-1dea3928a2e04d6acc7a43341fb54f36ddfcdc18.zip
add compound_lit.c test
Diffstat (limited to 'tests')
-rw-r--r--tests/indent/c/compound_lit.c10
-rw-r--r--tests/indent/c_spec.lua1
2 files changed, 11 insertions, 0 deletions
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 })