/usr/share/doc/r-cran-testthat/tests/testthat/reporters/tests.R is in r-cran-testthat 2.0.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | context("Expectations")
test_that("Success", {
succeed()
})
test_that("Failure:1", {
fail()
})
test_that("Failure:2a", {
f <- function() fail()
f()
})
test_that("Failure:2b", {
expect_true(FALSE)
})
test_that("Failure:loop", {
for (i in 1:2) {
expect_equal(i, 2)
}
})
context("Errors")
test_that("Error:1", {
stop("stop")
})
test_that("Error:3", {
f <- function() {
g()
}
g <- function() {
h()
}
h <- function() {
stop("!")
}
f()
})
context("Recursion")
test_that("Recursion:1", {
f <- function(x) {
if (x > 0) f(x - 1) else stop("This is deep")
}
f(25)
})
context("Skips")
test_that("Skip:1", {
skip("skip")
})
test_that("Skip:2", {
f <- function() {
skip("skip")
}
f()
})
test_that("Skip:3", {
})
context("Warnings")
test_that("Warning:1", {
warning("abc")
})
test_that("Warning:2", {
f <- function() {
warning("ghi")
}
warning("def")
f()
})
context("Output")
test_that("Output:1", {
expect_output(expect_false(FALSE), NA)
})
|