You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`expect_snapshot()` is the most used snapshot function because it records everything: the code you run, printed output, messages, warnings, and errors.
216
-
But sometimes you just want to capture the output or errors in which you might want to use `expect_snapshot_output()` or `expect_snapshot_error()`.
217
-
This can happen when the associated code is lengthy or doesn't add much in terms of capturing the test's intent.
218
-
`expect_snapshot_error()` predates `expect_snapshot()` and, if history had unfolded differently, `expect_snapshot(error = TRUE, ...)` probably would have made `expect_snapshot_error()` unnecessary.
219
+
If you care about the return value rather than any side-effects, you may might to use `expect_snapshot_value()` instead.
220
+
It offers a number of serialisation approaches that provide a tradeoff between accuracy and human readability.
219
221
220
-
Or rather than caring about side-effects, you may want to check that the value of an R object stays the same.
221
-
In this case, you can use `expect_snapshot_value()` which offers a number of serialisation approaches that provide a tradeoff between accuracy and human readability.
222
+
```{r}
223
+
test_that("can snapshot a simple list", {
224
+
x <- list(a = list(1, 5, 10), b = list("elephant", "banana"))
0 commit comments