diff options
| author | Pedro Castro <aspeddro@gmail.com> | 2022-01-28 22:33:48 -0300 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-01-29 15:25:56 +0100 |
| commit | d8f85649b8e667f96f35a87b5a15fd8165615b03 (patch) | |
| tree | 9a9ed14d76699c05c576a9a968f63bd1cec316c9 | |
| parent | indents(r): add aligned_indent test (diff) | |
| download | nvim-treesitter-d8f85649b8e667f96f35a87b5a15fd8165615b03.tar nvim-treesitter-d8f85649b8e667f96f35a87b5a15fd8165615b03.tar.gz nvim-treesitter-d8f85649b8e667f96f35a87b5a15fd8165615b03.tar.bz2 nvim-treesitter-d8f85649b8e667f96f35a87b5a15fd8165615b03.tar.lz nvim-treesitter-d8f85649b8e667f96f35a87b5a15fd8165615b03.tar.xz nvim-treesitter-d8f85649b8e667f96f35a87b5a15fd8165615b03.tar.zst nvim-treesitter-d8f85649b8e667f96f35a87b5a15fd8165615b03.zip | |
indents(r): add tests runner
| -rw-r--r-- | tests/indent/r_spec.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/indent/r_spec.lua b/tests/indent/r_spec.lua new file mode 100644 index 000000000..1bf6a2b50 --- /dev/null +++ b/tests/indent/r_spec.lua @@ -0,0 +1,35 @@ +local Runner = require("tests.indent.common").Runner + +local run = Runner:new(it, "tests/indent/r", { + tabstop = 2, + shiftwidth = 2, + softtabstop = 0, + expandtab = true, +}) + +describe("indent R:", function() + describe("whole file:", function() + run:whole_file "." + end) + + describe("new line:", function() + run:new_line("comment.R", { on_line = 1, text = "# new comment", indent = 0 }) + + run:new_line("cond.R", { on_line = 1, text = "x <- x + 1", indent = 0 }) + run:new_line("cond.R", { on_line = 4, text = "x <- x + 1", indent = 2 }) + run:new_line("cond.R", { on_line = 5, text = "x <- x + 1", indent = 2 }) + run:new_line("cond.R", { on_line = 8, text = "x <- x + 1", indent = 4 }) + + run:new_line("func.R", { on_line = 1, text = "x <- x + 1", indent = 2 }) + run:new_line("func.R", { on_line = 2, text = "a <- a + 1", indent = 4 }) + run:new_line("func.R", { on_line = 6, text = "0,", indent = 6 }) + run:new_line("func.R", { on_line = 6, text = "0,", indent = 6 }) + + run:new_line("loop.R", { on_line = 1, text = "x <- x + 1", indent = 0 }) + run:new_line("loop.R", { on_line = 3, text = "x <- x + 1", indent = 2 }) + run:new_line("loop.R", { on_line = 8, text = "x <- x + 1", indent = 2 }) + run:new_line("loop.R", { on_line = 14, text = "print('lol')", indent = 4 }) + + run:new_line("aligned_indent.R", { on_line = 1, text = "z,", indent = 17 }) + end) +end) |
