| 1 |
skip_if_not_installed("modeltests") |
| 2 |
library(modeltests) |
| 3 |
|
| 4 |
test_that("tidy.NULL", { |
| 5 |
expect_equal(tidy(NULL), tibble()) |
| 6 |
}) |
| 7 |
|
| 8 |
test_that("tidy.default", { |
| 9 |
expect_snapshot(error = TRUE, td <- tidy(raw(1))) |
| 10 |
|
| 11 |
x <- 5 |
| 12 |
class(x) <- c("foo", "bar") |
| 13 |
expect_snapshot(error = TRUE, glance(x)) |
| 14 |
expect_snapshot(error = TRUE, glance(x)) |
| 15 |
}) |
| 16 |
|
| 17 |
|
| 18 |
test_that("glance.NULL", { |
| 19 |
expect_equal(glance(NULL), tibble()) |
| 20 |
}) |
| 21 |
|
| 22 |
test_that("glance.default", { |
| 23 |
expect_snapshot(error = TRUE, glance(TRUE)) |
| 24 |
expect_snapshot(error = TRUE, glance(1)) |
| 25 |
expect_snapshot(error = TRUE, glance(1L)) |
| 26 |
expect_snapshot(error = TRUE, glance("a")) |
| 27 |
|
| 28 |
x <- 5 |
| 29 |
class(x) <- c("foo", "bar") |
| 30 |
expect_snapshot(error = TRUE, glance(x)) |
| 31 |
expect_snapshot(error = TRUE, glance(x)) |
| 32 |
}) |
| 33 |
|
| 34 |
test_that("augment.NULL", { |
| 35 |
expect_equal(augment(NULL), tibble()) |
| 36 |
}) |
| 37 |
|
| 38 |
test_that("augment.default", { |
| 39 |
expect_snapshot(error = TRUE, augment(TRUE)) |
| 40 |
expect_snapshot(error = TRUE, augment(1)) |
| 41 |
expect_snapshot(error = TRUE, augment(1L)) |
| 42 |
expect_snapshot(error = TRUE, augment("a")) |
| 43 |
|
| 44 |
x <- 5 |
| 45 |
class(x) <- c("foo", "bar") |
| 46 |
expect_snapshot(error = TRUE, augment(x)) |
| 47 |
expect_snapshot(error = TRUE, augment(x)) |
| 48 |
}) |