Skip to content

Commit 2eab6d3

Browse files
committed
adjust tests
1 parent 4b2b2fb commit 2eab6d3

File tree

6 files changed

+121
-126
lines changed

6 files changed

+121
-126
lines changed

tests/testthat/test-qenv_eval_code.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ testthat::test_that("eval_code works with quoted code block", {
7070

7171
testthat::expect_equal(
7272
q1@code,
73-
"a <- 1\nb <- 2"
73+
c("a <- 1", "b <- 2")
7474
)
7575
testthat::expect_equal(q1@env, list2env(list(a = 1, b = 2)))
7676
})
@@ -88,7 +88,7 @@ testthat::test_that("an error when calling eval_code returns a qenv.error object
8888
unname(q$trace),
8989
c("x <- 1", "y <- 2", "z <- w * x")
9090
)
91-
testthat::expect_equal(q$message, "object 'w' not found \n when evaluating qenv code:\nz <- w * x")
91+
testthat::expect_equal(q$message, "object 'w' not found \n when evaluating qenv code:\nexpression(z <- w * x)")
9292
})
9393

9494
testthat::test_that("a warning when calling eval_code returns a qenv object which has warnings", {
@@ -97,13 +97,13 @@ testthat::test_that("a warning when calling eval_code returns a qenv object whic
9797
testthat::expect_s4_class(q, "qenv")
9898
testthat::expect_equal(
9999
q@warnings,
100-
c("", paste(rep("> \"ff\" is not a graphical parameter\n", 4), collapse = ""))
100+
c("", "> \"ff\" is not a graphical parameter\n")
101101
)
102102
})
103103

104104
testthat::test_that("eval_code with a vector of code produces one warning element per code element", {
105105
q <- eval_code(qenv(), c("x <- 1", "y <- 1", "warning('warn1')"))
106-
testthat::expect_equal(c("> warn1\n"), q@warnings)
106+
testthat::expect_equal(c("", "", "> warn1\n"), q@warnings)
107107
})
108108

109109

0 commit comments

Comments
 (0)