diff options
| author | Pedro Castro <aspeddro@gmail.com> | 2022-01-28 19:21:50 -0300 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-01-29 15:25:56 +0100 |
| commit | 995f46289869699230b4240bc7d6bc665b373c1e (patch) | |
| tree | 14aeb4d0c4be30aa94ef63f79e4649db7adec6a2 /tests/indent | |
| parent | indents(r): add indents support (diff) | |
| download | nvim-treesitter-995f46289869699230b4240bc7d6bc665b373c1e.tar nvim-treesitter-995f46289869699230b4240bc7d6bc665b373c1e.tar.gz nvim-treesitter-995f46289869699230b4240bc7d6bc665b373c1e.tar.bz2 nvim-treesitter-995f46289869699230b4240bc7d6bc665b373c1e.tar.lz nvim-treesitter-995f46289869699230b4240bc7d6bc665b373c1e.tar.xz nvim-treesitter-995f46289869699230b4240bc7d6bc665b373c1e.tar.zst nvim-treesitter-995f46289869699230b4240bc7d6bc665b373c1e.zip | |
indents(r): add tests
Diffstat (limited to 'tests/indent')
| -rw-r--r-- | tests/indent/r/comment.R | 2 | ||||
| -rw-r--r-- | tests/indent/r/cond.R | 12 | ||||
| -rw-r--r-- | tests/indent/r/func.R | 12 | ||||
| -rw-r--r-- | tests/indent/r/loop.R | 17 | ||||
| -rw-r--r-- | tests/indent/r/pipe.R | 7 |
5 files changed, 50 insertions, 0 deletions
diff --git a/tests/indent/r/comment.R b/tests/indent/r/comment.R new file mode 100644 index 000000000..4396e1785 --- /dev/null +++ b/tests/indent/r/comment.R @@ -0,0 +1,2 @@ +# some +# comment diff --git a/tests/indent/r/cond.R b/tests/indent/r/cond.R new file mode 100644 index 000000000..865192915 --- /dev/null +++ b/tests/indent/r/cond.R @@ -0,0 +1,12 @@ +x <- 10 + +if (x > 3) { + x <- 3 +} else if (x < 3) { + x <- -3 +} else { + if (x > 0) { + x <- 1 + } + x <- 0 +} diff --git a/tests/indent/r/func.R b/tests/indent/r/func.R new file mode 100644 index 000000000..bc184dfb7 --- /dev/null +++ b/tests/indent/r/func.R @@ -0,0 +1,12 @@ +foo <- function(x) { + bar <- function(a, b, c) { + return(a + b + c) + } + return( + bar( + x, + 1, + 2 + ) + ) +} diff --git a/tests/indent/r/loop.R b/tests/indent/r/loop.R new file mode 100644 index 000000000..610bf6a7f --- /dev/null +++ b/tests/indent/r/loop.R @@ -0,0 +1,17 @@ +x <- 1 + +while (x < 10) { + x <- x + 1 + break +} + +for (i in 1:3) { + x <- x + 1 +} + +repeat { + x <- x + 1 + if (x > 100) { + break + } +} 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 + ) |
