Skip to content

Commit

Permalink
Add test for rendering documents
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Jan 16, 2025
1 parent 99a009a commit d4812f1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/testthat/documents/quiz.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
output: moodlequiz::moodlequiz
title: Multi-question example
---

## Start

```{r, include = FALSE}
library(moodlequiz)
```

What is 2 + 2? `r cloze(4)`

What is 2 + 3? `r cloze(5)`


```{r}
hist(rnorm(100))
```

What is the command for calculating the average? `r cloze("mean")`

## Easy

Lucky dip, pick a number on the dice!
`r cloze(sample(1:6, 1))`
3 changes: 3 additions & 0 deletions tests/testthat/test-moodlequiz-format.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test_that("Moodlequiz format", {
expect_message(rmarkdown::render("documents/quiz.Rmd", output_file = quiz_xml <- tempfile()), "Output created")
})

0 comments on commit d4812f1

Please sign in to comment.