Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* New `vignette("challenging-functions")` provides an index to other documentation organised by testing challenges (#1265).
* When running a test interactively, testthat now reports the number of succeses. The results should also be more useful if you are using nested tests.
* The hints generated by `expect_snapshot()` and `expect_snapshot_file()` now include the path to the package, if its not in the current working directory (#1577).
* `expect_snapshot_file()` now clearly errors if the `path` doesnt exist (#2191).
* `expect_snapshot_file()` now clearly errors if the `path` doesn't exist (#2191).
* `expect_snapshot_file()` now considers `.json` to be a text file (#1593).
* `expect_snapshot_file()` now shows differences for text files (#1593).
* The failure messages for all `expect_` functions have been rewritten to first state what was expected and then what was actually received (#2142).
Expand All @@ -19,7 +19,7 @@
* `local_mock()` and `with_mock()` have been deprecated because they are no longer permitted in R 4.5.
* `snapshot_review()` now passes `...` on to `shiny::runApp()` (#1928).
* `expect_named()` now gives more informative errors (#2091).
* `expect_*()` functions consistently and rigorously check their inputs (#1754).
* `expect_*()` functions consistently and rigorously check their inputs (#1754).
* `test_that()` no longer warns about the absence of `{}` since it no longer seems to be necessary.
* `test_that()`, `describe()`, and `it()` can now be arbitrarily nested. Each component will skip only if it and its subtests don't contain any expectations. The interactive stop reporter has been fixed so it doesn't duplicate failures. (#2063, #2188).
* Test filtering now works with `it()`, and the `desc` argument can take a character vector in order to recursively filter subtests (i.e. `it()` nested inside of `describe()`) (#2118).
Expand All @@ -38,7 +38,7 @@
* New `expect_r6_class()` (#2030).
* `expect_*()` functions consistently and rigorously check their inputs (#1754).
* `JunitReporter()` no longer fails with `"no applicable method for xml_add_child"` for warnings outside of tests (#1913). Additionally, warnings now save their backtraces.
* `JunitReporter()` strips ANSI escapes in more placese (#1852, #2032).
* `JunitReporter()` strips ANSI escapes in more places (#1852, #2032).
* `try_again()` is now publicised. The first argument is now the number of retries, not tries (#2050).
* `vignette("custom-expectations)` has been overhauled to make it much clearer how to create high-quality expectations (#2113, #2132, #2072).
* `expect_snapshot()` and friends will now fail when creating a new snapshot on CI. This is usually a signal that you've forgotten to run it locally before committing (#1461).
Expand Down Expand Up @@ -987,7 +987,7 @@ This release mostly focusses on an overhaul of how testthat works with condition
* In `expect_equal_to_reference()`, the default value for `update` is
now `FALSE` (@BrodieG, #683).

* `expect_error()` now returns the error object as documentated (#724).
* `expect_error()` now returns the error object as documented (#724).
It also now warns if you're using a classed expectation and you're
not using the `class` argument. This is good practice as it decouples the
error object (which tends to be stable) from its rendering to the user
Expand Down Expand Up @@ -1679,7 +1679,7 @@ The reporters system class has been considerably refactored to make existing rep
* `safe_digest()` uses a better strategy, and returns NA for directories
(#138, #146).

* Random praise is renabled by default (again!) (#164).
* Random praise is re-enabled by default (again!) (#164).

* Teamcity reporter now correctly escapes output messages (#150, @windelinckx).
It also uses nested suites to include test names.
Expand Down
2 changes: 1 addition & 1 deletion R/expect-self-test.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ capture_success_failure <- function(expr) {
#' Use `show_failure()` in examples to print the failure message without
#' throwing an error.
#'
#' @param expr Code to evalute
#' @param expr Code to evaluate
#' @param message Check that the failure message matches this regexp.
#' @param ... Other arguments passed on to [expect_match()].
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/expect-that.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#' @param srcref Location of the failure. Should only needed to be explicitly
#' supplied when you need to forward a srcref captured elsewhere.
#' @param trace_env If `trace` is not specified, this is used to generate an
#' informative traceack for failures. You should only need to set this if
#' informative traceback for failures. You should only need to set this if
#' you're calling `fail()` from a helper function; see
#' `vignette("custom-expectation")` for details.
#' @param trace An optional backtrace created by [rlang::trace_back()].
Expand Down
2 changes: 1 addition & 1 deletion R/mock2.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
#'
#' To mock a function that returns different values in sequence,
#' for instance an API call whose status would be 502 then 200,
#' or an user intput to `readline()`, you can use [mock_output_sequence()]
#' or an user input to `readline()`, you can use [mock_output_sequence()]
#'
#' ```R
#' local_mocked_bindings(readline = mock_output_sequence("3", "This is a note", "n"))
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-stop.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' @description
#' The default reporter used when [expect_that()] is run interactively.
#' It responds by displaying a summary of the number of successes and faiures
#' It responds by displaying a summary of the number of successes and failures
#' and [stop()]ping on if there are any failures.
#'
#' @export
Expand Down
4 changes: 2 additions & 2 deletions R/test-compiled-code.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ run_cpp_tests <- function(package) {
#' \strong{Function} \tab \strong{Catch} \tab \strong{Description} \cr
#' `context` \tab `CATCH_TEST_CASE` \tab The context of a set of tests. \cr
#' `test_that` \tab `CATCH_SECTION` \tab A test section. \cr
#' `expect_true` \tab `CATCH_CHECK` \tab Test that an expression evaluates to `true`. \cr
#' `expect_false` \tab `CATCH_CHECK_FALSE` \tab Test that an expression evalutes to `false`. \cr
#' `expect_true` \tab `CATCH_CHECK` \tab Test that an expression evaluates to `TRUE`. \cr
#' `expect_false` \tab `CATCH_CHECK_FALSE` \tab Test that an expression evaluates to `FALSE`. \cr
#' `expect_error` \tab `CATCH_CHECK_THROWS` \tab Test that evaluation of an expression throws an exception. \cr
#' `expect_error_as` \tab `CATCH_CHECK_THROWS_AS` \tab Test that evaluation of an expression throws an exception of a specific class. \cr
#' }
Expand Down
6 changes: 3 additions & 3 deletions R/watcher.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#'
#' @param path character vector of paths to watch. Omit trailing backslash.
#' @param pattern file pattern passed to [dir()]
#' @param callback function called everytime a change occurs. It should
#' @param callback function called every time a change occurs. It should
#' have three parameters: added, deleted, modified, and should return
#' TRUE to keep watching, or FALSE to stop.
#' `TRUE` to keep watching, or `FALSE` to stop.
#' @param hash hashes are more accurate at detecting changes, but are slower
#' for large files. When FALSE, uses modification time stamps
#' for large files. When `FALSE`, uses modification time stamps
#' @export
#' @keywords internal
watch <- function(path, callback, pattern = NULL, hash = TRUE) {
Expand Down
2 changes: 1 addition & 1 deletion man/StopReporter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/expect.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/expect_success.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fail.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/local_mocked_bindings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/use_catch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/watch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/challenging-tests.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ If your package is going to CRAN, you **must** either use one of these packages

## Graphics

The only type of testing you can use for graphics is snapshot testing (`vignette("snapshotting")`) via `expect_snapshot_file()`. Graphical snapshot testing is surprisingly challenging because you need pixel-perfect rendering across multiple versions of multiple operating systems, and this is hard, mostly due to imperceptble differences in font rendering. Fortunately we've needed to overcome these challenges in order to test ggplot2, and you can benefit from our experience by using {vdiffr} when testing graphical output.
The only type of testing you can use for graphics is snapshot testing (`vignette("snapshotting")`) via `expect_snapshot_file()`. Graphical snapshot testing is surprisingly challenging because you need pixel-perfect rendering across multiple versions of multiple operating systems, and this is hard, mostly due to imperceptible differences in font rendering. Fortunately we've needed to overcome these challenges in order to test {ggplot2}, and you can benefit from our experience by using {vdiffr} when testing graphical output.

## User interaction

Expand Down
2 changes: 1 addition & 1 deletion vignettes/third-edition.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ The following changes are most likely to affect you:
It's worth thinking about what the correct values should be, but if that is to annoying you can opt out of the comparison with `ignore_function_env` or `ignore_formula_env`.

- `expect_equal()` used a combination of `all.equal()` and a home-grown `testthat::compare()` which unfortunately used a slightly different definition of tolerance.
Now `expect_equal()` always uses the same definition of tolerance everywhere, which may require tweaks to your exising tolerance values.
Now `expect_equal()` always uses the same definition of tolerance everywhere, which may require tweaks to your existing tolerance values.

- `expect_equal()` previously ignored timezone differences when one object had the current timezone set implicitly (with `""`) and the other had it set explicitly:

Expand Down
Loading