Skip to content

Commit ee20c59

Browse files
committed
Deploying to gh-pages from @ d880776 πŸš€
1 parent 3868b36 commit ee20c59

10 files changed

Lines changed: 27 additions & 14 deletions

β€Ždev/articles/custom-expectation.htmlβ€Ž

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždev/articles/custom-expectation.mdβ€Ž

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ If the object is as expected, call
144144
[`pass()`](https://testthat.r-lib.org/dev/reference/fail.md). This
145145
ensures that a success will be registered in the test reporter.
146146

147+
Otherwise, call
148+
[`fail()`](https://testthat.r-lib.org/dev/reference/fail.md). This
149+
ensures that a failure will be registered in the test reporter. NB:
150+
unlike [`stop()`](https://rdrr.io/r/base/stop.html) or `abort()`,
151+
[`fail()`](https://testthat.r-lib.org/dev/reference/fail.md) signals a
152+
failure but allows code execution to continue, ensuring that one failure
153+
does not prevent subsequent expectations from running.
154+
147155
Finally, return the input value (`act$val`) invisibly. This is good
148156
practice because expectations are called primarily for their
149157
side-effects (triggering a failure), and returning the value allows

β€Ždev/articles/mocking.htmlβ€Ž

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždev/articles/mocking.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ function to mock.
292292
``` r
293293
unix_time <- function() unclass(Sys.time())
294294
unix_time()
295-
#> [1] 1763976105
295+
#> [1] 1763976292
296296
```
297297

298298
Now I’m going to create a function factory that makes it easy to compute
@@ -309,7 +309,7 @@ elapsed <- function() {
309309
timer <- elapsed()
310310
Sys.sleep(0.5)
311311
timer()
312-
#> [1] 0.5019979
312+
#> [1] 0.5014899
313313
```
314314

315315
Imagine trying to test this function without mocking! You’d probably

β€Ždev/articles/snapshotting.htmlβ€Ž

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždev/articles/snapshotting.mdβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ test_that("generates actionable error message", {
386386
#> safe_write_lines(letters, path)
387387
#> Condition
388388
#> Error in `safe_write_lines()`:
389-
#> ! '/tmp/RtmpVqjUmn/file26255e5cbdda' already exists.
389+
#> ! '/tmp/Rtmpmq6IE2/file26193629143' already exists.
390390
#> i Set `overwrite = TRUE` to overwrite
391391
#> Test passed with 1 success 🎊.
392392
```
@@ -402,8 +402,8 @@ test_that("generates actionable error message", {
402402
#> safe_write_lines(letters, path)
403403
#> Condition
404404
#> Error in `safe_write_lines()`:
405-
#> - ! '/tmp/RtmpVqjUmn/file26255e5cbdda' already exists.
406-
#> + ! '/tmp/RtmpVqjUmn/file26253872c087' already exists.
405+
#> - ! '/tmp/Rtmpmq6IE2/file26193629143' already exists.
406+
#> + ! '/tmp/Rtmpmq6IE2/file261914c374d9' already exists.
407407
#> i Set `overwrite = TRUE` to overwrite
408408
#> * Run `testthat::snapshot_accept("snapshotting.Rmd")` to accept the change.
409409
#> * Run `testthat::snapshot_review("snapshotting.Rmd")` to review the change.

β€Ždev/pkgdown.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ articles:
1111
special-files: special-files.html
1212
test-fixtures: test-fixtures.html
1313
third-edition: third-edition.html
14-
last_built: 2025-11-24T09:21Z
14+
last_built: 2025-11-24T09:24Z
1515
urls:
1616
reference: https://testthat.r-lib.org/reference
1717
article: https://testthat.r-lib.org/articles

β€Ždev/reference/expect_snapshot_file.htmlβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždev/reference/expect_snapshot_file.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ save_png <- function(code, width = 400, height = 400) {
129129
}
130130
path <- save_png(plot(1:5))
131131
path
132-
#> [1] "/tmp/Rtmpvb88Go/file18e56d534d09.png"
132+
#> [1] "/tmp/RtmpsOxXPe/file18d961ad8814.png"
133133

134134
if (FALSE) { # \dontrun{
135135
expect_snapshot_file(save_png(hist(mtcars$mpg)), "plot.png")

β€Ždev/search.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
Β (0)