File: test-R5.R

package info (click to toggle)
r-cran-pander 0.6.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,804 kB
  • sloc: javascript: 301; cpp: 145; lisp: 94; makefile: 21
file content (21 lines) | stat: -rw-r--r-- 651 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
library(testthat)
library(pander)
context('Pandoc R5 reference class')

graph.dir <- evalsOptions('graph.dir')
evalsOptions('graph.dir',  file.path(tempdir(), 'plots'))

test_that('quick demo on R5 refclass', {
    myReport <- Pandoc$new()
    myReport$add.paragraph('Hello there!')
    myReport$add(head(mtcars))
    myReport$add(chisq.test(table(mtcars$am, mtcars$gear)))
    expect_true(class(myReport) == 'Pandoc')
    expect_equal(length(capture.output(myReport)), 63)
    t <- tempfile()
    myReport$format <- 'html'
    expect_equal(myReport$export(t, open = FALSE), paste0(t, '.html'))
    unlink(t)
})

evalsOptions('graph.dir',  graph.dir)