-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow empty exercise code chunks (#712)
- Loading branch information
Showing
6 changed files
with
185 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/testthat/tutorials/knitr-hooks_empty-exercise/duplicate-label.Rmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: Empty Exercise Code with Duplicate | ||
output: learnr::tutorial | ||
runtime: shinyrmd | ||
--- | ||
|
||
```{r setup, include = FALSE} | ||
library(learnr) | ||
tutorial_options(exercise.lines = 4L) | ||
knitr::opts_chunk$set( | ||
echo = FALSE, | ||
custom_chunk_opt = "default", | ||
fig.path = "figures", | ||
cache.path = "cache" | ||
) | ||
``` | ||
|
||
## Test | ||
|
||
### First empty | ||
|
||
This tutorial should fail to parse. | ||
|
||
```{r empty} | ||
``` | ||
|
||
### Empty | ||
|
||
```{r empty, exercise = TRUE, custom_chunk_opt = "custom"} | ||
``` | ||
|
||
```{r empty-hint} | ||
# hint code | ||
``` | ||
|
||
```{r empty-solution} | ||
mtcars | ||
``` |
32 changes: 32 additions & 0 deletions
32
tests/testthat/tutorials/knitr-hooks_empty-exercise/empty-exercise.Rmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: Empty Exercise Code | ||
output: learnr::tutorial | ||
runtime: shinyrmd | ||
--- | ||
|
||
```{r setup, include = FALSE} | ||
library(learnr) | ||
tutorial_options(exercise.lines = 4L) | ||
knitr::opts_chunk$set( | ||
echo = FALSE, | ||
custom_chunk_opt = "default", | ||
fig.path = "figures", | ||
cache.path = "cache" | ||
) | ||
``` | ||
|
||
## Test | ||
|
||
### Empty | ||
|
||
```{r empty, exercise = TRUE, custom_chunk_opt = "custom"} | ||
``` | ||
|
||
```{r empty-hint} | ||
# hint code | ||
``` | ||
|
||
```{r empty-solution} | ||
mtcars | ||
``` |
36 changes: 36 additions & 0 deletions
36
tests/testthat/tutorials/knitr-hooks_empty-exercise/full-exercise.Rmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: Empty Exercise Code | ||
output: learnr::tutorial | ||
runtime: shinyrmd | ||
--- | ||
|
||
```{r setup, include = FALSE} | ||
library(learnr) | ||
tutorial_options(exercise.lines = 4L) | ||
knitr::opts_chunk$set( | ||
echo = FALSE, | ||
custom_chunk_opt = "default", | ||
fig.path = "figures", | ||
cache.path = "cache" | ||
) | ||
``` | ||
|
||
## Test | ||
|
||
### Empty | ||
|
||
```{r empty, exercise = TRUE, custom_chunk_opt = "custom"} | ||
``` | ||
|
||
```{r empty-hint} | ||
# hint code | ||
``` | ||
|
||
```{r empty-solution} | ||
mtcars | ||
``` |