Skip to content

Commit 146482a

Browse files
include non-R code chunks in tests
1 parent 77757f1 commit 146482a

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

tests/testthat/public-api/xyzfile_rmd/random2.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Some text before empty chunk
77
```
88
Final text before longer code chunk
99
This text chunk has multiple lines
10-
```{r}
10+
```{R}
1111
# random
1212
this(is_a_call(x))
1313
if (x) {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Header
2+
3+
Some text.
4+
5+
```{R}
6+
1+1
7+
```
8+
9+
More text.
10+
11+
```{nonR}
12+
I like the jungle, I like the .2'
13+
```
14+
15+
```{blabla }
16+
I like the jungle,
17+
```
18+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Header
2+
3+
Some text.
4+
5+
```{R}
6+
1 + 1
7+
```
8+
9+
More text.
10+
11+
```{nonR}
12+
I like the jungle, I like the .2'
13+
```
14+
15+
```{blabla }
16+
I like the jungle,
17+
```
18+

tests/testthat/test-rmd.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
context("rmd")
22

33
test_that("can style .Rmd files", {
4-
test_collection(
5-
"rmd",
4+
expect_error(test_collection(
5+
"rmd", "simple",
66
transformer = transform_rmd,
77
transformer_fun = style_text,
88
write_tree = FALSE
9-
)
9+
), NA)
10+
expect_error(test_collection(
11+
"rmd", "r_and_non_r_code_chunks",
12+
transformer = transform_rmd,
13+
transformer_fun = style_text,
14+
write_tree = FALSE
15+
), NA)
1016
})

0 commit comments

Comments
 (0)