Debian Codegraph @

inst/tests/test-R5.R

raw
1 library(testthat)
2 library(pander)
3 context('Pandoc R5 reference class')
4
5 graph.dir <- evalsOptions('graph.dir')
6 evalsOptions('graph.dir', file.path(tempdir(), 'plots'))
7
8 test_that('quick demo on R5 refclass', {
9 myReport <- Pandoc$new()
10 myReport$add.paragraph('Hello there!')
11 myReport$add(head(mtcars))
12 myReport$add(chisq.test(table(mtcars$am, mtcars$gear)))
13 expect_true(class(myReport) == 'Pandoc')
14 expect_equal(length(capture.output(myReport)), 63)
15 t <- tempfile()
16 myReport$format <- 'html'
17 expect_equal(myReport$export(t, open = FALSE), paste0(t, '.html'))
18 unlink(t)
19 })
20
21 evalsOptions('graph.dir', graph.dir)