indents(r): add tests

This commit is contained in:
Pedro Castro 2022-01-28 19:21:50 -03:00 committed by Stephan Seitz
parent 807b20d0de
commit 995f462898
5 changed files with 50 additions and 0 deletions

2
tests/indent/r/comment.R Normal file
View file

@ -0,0 +1,2 @@
# some
# comment

12
tests/indent/r/cond.R Normal file
View 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
View 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
View 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
View file

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