mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
indents(r): add tests
This commit is contained in:
parent
807b20d0de
commit
995f462898
5 changed files with 50 additions and 0 deletions
2
tests/indent/r/comment.R
Normal file
2
tests/indent/r/comment.R
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# some
|
||||
# comment
|
||||
12
tests/indent/r/cond.R
Normal file
12
tests/indent/r/cond.R
Normal file
|
|
@ -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
|
||||
}
|
||||
12
tests/indent/r/func.R
Normal file
12
tests/indent/r/func.R
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
foo <- function(x) {
|
||||
bar <- function(a, b, c) {
|
||||
return(a + b + c)
|
||||
}
|
||||
return(
|
||||
bar(
|
||||
x,
|
||||
1,
|
||||
2
|
||||
)
|
||||
)
|
||||
}
|
||||
17
tests/indent/r/loop.R
Normal file
17
tests/indent/r/loop.R
Normal file
|
|
@ -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
|
||||
}
|
||||
}
|
||||
7
tests/indent/r/pipe.R
Normal file
7
tests/indent/r/pipe.R
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
mtcars |>
|
||||
head(
|
||||
n = 6L
|
||||
) |>
|
||||
subset(
|
||||
cyl > 3
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue