diff options
| author | Michael Hoffmann <mhoffm@posteo.de> | 2022-12-02 23:47:19 +0100 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-12-29 22:18:41 +0100 |
| commit | ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f (patch) | |
| tree | f638bb4493056146317796d894464801b805118b /tests/indent/terraform_spec.lua | |
| parent | Update parsers: astro, ocaml, ocaml_interface (diff) | |
| download | nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar.gz nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar.bz2 nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar.lz nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar.xz nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.tar.zst nvim-treesitter-ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f.zip | |
feat(hcl,terraform): split terraform from hcl, add specialized queries for tf
This enables us to have different queries for
terraform and general hcl. It solve the situation
where other dialects of hcl (nomad, packer, etc)
might use a terraform keyword and get highlighted
out of place.
Diffstat (limited to 'tests/indent/terraform_spec.lua')
| -rw-r--r-- | tests/indent/terraform_spec.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/indent/terraform_spec.lua b/tests/indent/terraform_spec.lua new file mode 100644 index 000000000..49fa22c20 --- /dev/null +++ b/tests/indent/terraform_spec.lua @@ -0,0 +1,35 @@ +local Runner = require("tests.indent.common").Runner +--local XFAIL = require("tests.indent.common").XFAIL + +local run = Runner:new(it, "tests/indent/terraform", { + tabstop = 2, + shiftwidth = 2, + expandtab = true, +}) + +describe("indent Terraform:", function() + describe("whole file:", function() + run:whole_file(".", { + expected_failures = {}, + }) + end) + + describe("new line:", function() + run:new_line("no-indent-after-brace.tf", { on_line = 4, text = "# Wow, no indent here please", indent = 0 }) + run:new_line("indent-in-multiline-tuples.tf", { on_line = 4, text = "3,", indent = 4 }) + run:new_line("indent-in-multiline-tuples.tf", { on_line = 3, text = "# as elements", indent = 4 }) + run:new_line("indent-in-multiline-tuples.tf", { on_line = 5, text = "# as outer block", indent = 2 }) + run:new_line("indent-in-multiline-tuples.tf", { on_line = 1, text = "# as outer block", indent = 2 }) + run:new_line("indent-in-multiline-objects.tf", { on_line = 4, text = '3: "baz",', indent = 4 }) + run:new_line("indent-in-multiline-objects.tf", { on_line = 3, text = "# as elements", indent = 4 }) + run:new_line("indent-in-multiline-objects.tf", { on_line = 5, text = "# as outer block", indent = 2 }) + run:new_line("indent-in-multiline-objects.tf", { on_line = 1, text = "# as outer block", indent = 2 }) + run:new_line("multiple-attributes.tf", { on_line = 2, text = "a = 1", indent = 2 }) + run:new_line("multiple-attributes.tf", { on_line = 3, text = "a = 1", indent = 2 }) + run:new_line("multiple-attributes.tf", { on_line = 4, text = "a = 1", indent = 0 }) + run:new_line("nested_blocks.tf", { on_line = 3, text = "a = 1", indent = 4 }) + run:new_line("nested_blocks.tf", { on_line = 4, text = "a = 1", indent = 2 }) + run:new_line("function_call.tf", { on_line = 4, text = "c,", indent = 4 }) + run:new_line("function_call.tf", { on_line = 5, text = "a = 1", indent = 2 }) + end) +end) |
