Debian Codegraph @

tests/testthat/test-par.R

raw
1 test_that("with_par works as expected", {
2 local_pdf(local_tempfile())
3
4 old <- par("pty")
5 with_par(list(pty = "s"), {
6 expect_equal(par("pty"), "s")
7 })
8 expect_equal(par("pty"), old)
9 })
10
11 test_that("local_par works as expected", {
12 local_pdf(local_tempfile())
13
14 old <- par("pty")
15 local({
16 local_par(list(pty = "s"))
17 expect_equal(par("pty"), "s")
18 })
19 expect_equal(par("pty"), old)
20 })
21
22 test_that("empty par doesn't give warning", {
23 local_pdf(local_tempfile())
24
25 expect_no_warning(with_par(list(), par(pty="s")))
26 })