From 3606f8efbb6d02f78336965ae5c59614e39c9ebf Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Sat, 29 Jan 2022 10:36:50 -0300 Subject: indents(r): add pipe test --- tests/indent/r/pipe.R | 7 +++++++ tests/indent/r_spec.lua | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/indent/r/pipe.R diff --git a/tests/indent/r/pipe.R b/tests/indent/r/pipe.R new file mode 100644 index 000000000..2eef84218 --- /dev/null +++ b/tests/indent/r/pipe.R @@ -0,0 +1,7 @@ +mtcars |> + head( + n = 6L + ) |> + subset( + cyl > 3 + ) diff --git a/tests/indent/r_spec.lua b/tests/indent/r_spec.lua index 1bf6a2b50..20454df7c 100644 --- a/tests/indent/r_spec.lua +++ b/tests/indent/r_spec.lua @@ -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) -- cgit v1.2.3-70-g09d2