indents(r): add pipe test

This commit is contained in:
Pedro Castro 2022-01-29 10:36:50 -03:00 committed by Stephan Seitz
parent d8f85649b8
commit 3606f8efbb
2 changed files with 15 additions and 1 deletions

7
tests/indent/r/pipe.R Normal file
View file

@ -0,0 +1,7 @@
mtcars |>
head(
n = 6L
) |>
subset(
cyl > 3
)

View file

@ -1,4 +1,5 @@
local Runner = require("tests.indent.common").Runner
local XFAIL = require("tests.indent.common").XFAIL
local run = Runner:new(it, "tests/indent/r", {
tabstop = 2,
@ -9,7 +10,11 @@ local run = Runner:new(it, "tests/indent/r", {
describe("indent R:", function()
describe("whole file:", function()
run:whole_file "."
run:whole_file(".", {
expected_failures = {
"r/pipe.R",
},
})
end)
describe("new line:", function()
@ -30,6 +35,8 @@ describe("indent R:", function()
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("pipe.R", { on_line = 1, text = "head(n = 10L) |>", indent = 2 }, "expected failure", XFAIL)
run:new_line("aligned_indent.R", { on_line = 1, text = "z,", indent = 17 })
end)
end)