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
1 change: 1 addition & 0 deletions R/describe.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#'
#' @param description description of the feature
#' @param code test code containing the specs
#' @keywords internal
#' @export
#' @examples
#' describe("matrix()", {
Expand Down
2 changes: 1 addition & 1 deletion R/expect-comparison.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code return a number greater/less than the expected value?
#' Do you expect a number bigger or smaller than this?
#'
#' @inheritParams expect_equal
#' @param object,expected A value to compare and its expected bound.
Expand Down
2 changes: 1 addition & 1 deletion R/expect-condition.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code throw an error, warning, message, or other condition?
#' Do you expect an error, warning, message, or other condition?
#'
#' @description
#' `expect_error()`, `expect_warning()`, `expect_message()`, and
Expand Down
4 changes: 2 additions & 2 deletions R/expect-constant.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code return `TRUE` or `FALSE`?
#' Do you expect `TRUE` or `FALSE`?
#'
#' @description
#' These are fall-back expectations that you can use when none of the other
Expand Down Expand Up @@ -42,7 +42,7 @@ expect_false <- function(object, info = NULL, label = NULL) {
expect_waldo_equal_("equal", act, exp, info = info, ignore_attr = TRUE)
}

#' Does code return `NULL`?
#' Do you expect `NULL`?
#'
#' This is a special case because `NULL` is a singleton so it's possible
#' check for it either with `expect_equal(x, NULL)` or `expect_type(x, "NULL")`.
Expand Down
2 changes: 1 addition & 1 deletion R/expect-equality.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code return the expected value?
#' Do you expect this value?
#'
#' @description
#' These functions provide two levels of strictness when comparing a
Expand Down
5 changes: 2 additions & 3 deletions R/expect-inheritance.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#' Does code return an object inheriting from the expected base type, S3 class,
#' or S4 class?
#' Do you expect an S3/S4/R6/S7 object that inherits from this class?
#'
#' @description
#' See <https://adv-r.hadley.nz/oo.html> for an overview of R's OO systems, and
Expand Down Expand Up @@ -207,7 +206,7 @@ expect_s7_class <- function(object, class) {
pass(act$val)
}

#' Does an object inherit from a given class?
#' Do you expect to inherit from this class?
#'
#' @description
#' `r lifecycle::badge("superseded")`
Expand Down
2 changes: 1 addition & 1 deletion R/expect-invisible.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code return a visible or invisible object?
#' Do you expect the result to be (in)visible?
#'
#' Use this to test whether a function returns a visible or invisible
#' output. Typically you'll use this to check that functions called primarily
Expand Down
4 changes: 2 additions & 2 deletions R/expect-known.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Expectations: is the output or the value equal to a known good value?
#' Do you expect the results/output to equal a known value?
#'
#' For complex printed output and objects, it is often challenging to describe
#' exactly what you expect to see. `expect_known_value()` and
Expand Down Expand Up @@ -113,7 +113,7 @@ compare_file <- function(path, lines, ..., update = TRUE, info = NULL) {
pass(NULL)
}

#' Expectations: is the output or the value equal to a known good value?
#' Do you expect the output/result to equal a known good value?
#'
#' `expect_output_file()` behaves identically to [expect_known_output()].
#'
Expand Down
2 changes: 1 addition & 1 deletion R/expect-length.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code return a vector with the specified length?
#' Do you expect a vector with this length?
#'
#' @seealso [expect_vector()] to make assertions about the "size" of a vector,
#' [expect_shape()] for more general assertions about object "shape".
Expand Down
2 changes: 1 addition & 1 deletion R/expect-match.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does a string match a regular expression?
#' Do you expect a string to match this pattern?
#'
#' @details
#' `expect_match()` checks if a character vector matches a regular expression,
Expand Down
2 changes: 1 addition & 1 deletion R/expect-named.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code return a vector with (given) names?
#' Do you expect a vector with (these) names?
#'
#' You can either check for the presence of names (leaving `expected`
#' blank), specific names (by supplying a vector of names), or absence of
Expand Down
2 changes: 1 addition & 1 deletion R/expect-no-condition.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code run without error, warning, message, or other condition?
#' Do you expect the absence of errors, warnings, messages, or other conditions?
#'
#' @description
#' These expectations are the opposite of [expect_error()],
Expand Down
2 changes: 1 addition & 1 deletion R/expect-output.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code print output to the console?
#' Do you expect printed output to match this pattern?
#'
#' Test for output produced by `print()` or `cat()`. This is best used for
#' very simple output; for more complex cases use [expect_snapshot()].
Expand Down
2 changes: 1 addition & 1 deletion R/expect-reference.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code return a reference to the expected object?
#' Do you expect a reference to this object?
#'
#' `expect_reference()` compares the underlying memory addresses of
#' two symbols. It is for expert use only.
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 @@ -28,7 +28,7 @@ capture_success_failure <- function(expr) {
)
}

#' Tools for testing expectations
#' Test your custom expectations
#'
#' @description
#' `expect_success()` checks that there's exactly one success and no failures;
Expand Down
2 changes: 1 addition & 1 deletion R/expect-setequal.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code return a vector containing the expected values?
#' Do you expect a vector containing these values?
#'
#' * `expect_setequal(x, y)` tests that every element of `x` occurs in `y`,
#' and that every element of `y` occurs in `x`.
Expand Down
2 changes: 1 addition & 1 deletion R/expect-shape.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code return an object with the specified shape?
#' Do you expect an object with this shape?
#'
#' This is a generalization of [expect_length()] to test the "shape" of
#' more general objects like data.frames, matrices, and arrays.
Expand Down
2 changes: 1 addition & 1 deletion R/expect-silent.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code execute silently?
#' Do you expect code to execute silently?
#'
#' Checks that the code produces no output, messages, or warnings.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/expect-that.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' `pass()` or `fail()` a test
#' Declare that an expectation either passes or fails
#'
#' @description
#' These are the primitives that you can use to implement your own expectations.
Expand Down
2 changes: 1 addition & 1 deletion R/expect-vector.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Does code return a vector with the expected size and/or prototype?
#' Do you expect a vector with this size and/or prototype?
#'
#' `expect_vector()` is a thin wrapper around [vctrs::vec_assert()], converting
#' the results of that function in to the expectations used by testthat. This
Expand Down
2 changes: 1 addition & 1 deletion R/local.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Locally set options for maximal test reproducibility
#' Temporarily set options for maximum reproducibility
#'
#' @description
#' `local_test_context()` is run automatically by `test_that()` but you may
Expand Down
2 changes: 1 addition & 1 deletion R/mock2.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Mocking tools
#' Temporarily redefine function definitions
#'
#' @description
#' `with_mocked_bindings()` and `local_mocked_bindings()` provide tools for
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-check.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Check reporter: 13 line summary of problems
#' Report results for `R CMD check`
#'
#' `R CMD check` displays only the last 13 lines of the result, so this
#' report is designed to ensure that you see something useful there.
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-debug.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Test reporter: start recovery.
#' Interactively debug failing tests
#'
#' This reporter will call a modified version of [recover()] on all
#' broken expectations.
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-fail.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Test reporter: fail at end.
#' Fail if any tests fail
#'
#' This reporter will simply throw an error if any of the tests failed. It is
#' best combined with another reporter, such as the
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-junit.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ classnameOK <- function(text) {
}


#' Test reporter: summary of errors in jUnit XML format.
#' Report results in jUnit XML format
#'
#' This reporter includes detailed results about each test and summaries,
#' written to a file (or stdout) in jUnit XML format. This can be read by
Expand Down
3 changes: 1 addition & 2 deletions R/reporter-list.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
methods::setOldClass("proc_time")

#' List reporter: gather all test results along with elapsed time and
#' file information.
#' Capture test results and metadata
#'
#' This reporter gathers all results, adding additional information such as
#' test elapsed time, and test filename if available. Very useful for reporting.
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-minimal.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Test reporter: minimal.
#' Report minimal results as compactly as possible
#'
#' The minimal test reporter provides the absolutely minimum amount of
#' information: whether each expectation has succeeded, failed or experienced
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-multi.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Multi reporter: combine several reporters in one.
#' Run multiple reporters at the same time
#'
#' This reporter is useful to use several reporters at the same time, e.g.
#' adding a custom reporter without removing the current one.
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-progress.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Test reporter: interactive progress bar of errors.
#' Report progress interactively
#'
#' @description
#' `ProgressReporter` is designed for interactive use. Its goal is to
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-rstudio.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Test reporter: RStudio
#' Report results to RStudio
#'
#' This reporter is designed for output to RStudio. It produces results in
#' any easily parsed form.
Expand Down
5 changes: 2 additions & 3 deletions R/reporter-silent.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#' Test reporter: gather all errors silently.
#' Silently collect and all expectations
#'
#' This reporter quietly runs all tests, simply gathering all expectations.
#' This is helpful for programmatically inspecting errors after a test run.
#' You can retrieve the results with the `expectations()`
#' method.
#' You can retrieve the results with `$expectations()`.
#'
#' @export
#' @family reporters
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-slow.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Test reporter: show timings for slow tests
#' Find slow tests
#'
#' @description
#' `SlowReporter` is designed to identify slow tests. It reports the
Expand Down
3 changes: 2 additions & 1 deletion R/reporter-stop.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#' Test reporter: stop on error
#' Error if any test fails
#'
#' @description
#' The default reporter used when [expect_that()] is run interactively.
#' It responds by [stop()]ping on failures and doing nothing otherwise. This
#' will ensure that a failing test will raise an error.
Expand Down
10 changes: 5 additions & 5 deletions R/reporter-summary.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#' Test reporter: summary of errors.
#' Report a summary of failures
#'
#' This is a reporter designed for interactive usage: it lets you know which
#' tests have run successfully and as well as fully reporting information about
#' @description
#' This is designed for interactive usage: it lets you know which tests have
#' run successfully and as well as fully reporting information about
#' failures and errors.
#'
#' You can use the `max_reports` field to control the maximum number
#' of detailed reports produced by this reporter. This is useful when running
#' with [auto_test()]
#' of detailed reports produced by this reporter.
#'
#' As an additional benefit, this reporter will praise you from time-to-time
#' if all your tests pass.
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-tap.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Test reporter: TAP format.
#' Report results in TAP format
#'
#' This reporter will output results in the Test Anything Protocol (TAP),
#' a simple text-based interface between testing modules in a test harness.
Expand Down
2 changes: 1 addition & 1 deletion R/reporter-teamcity.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Test reporter: Teamcity format.
#' Report results in Teamcity format
#'
#' This reporter will output results in the Teamcity message format.
#' For more information about Teamcity messages, see
Expand Down
2 changes: 1 addition & 1 deletion R/skip.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Skip a test
#' Skip a test for various reasons
#'
#' @description
#' `skip_if()` and `skip_if_not()` allow you to skip tests, immediately
Expand Down
2 changes: 1 addition & 1 deletion R/snapshot-file.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Snapshot testing for whole files
#' Do you expect this code to create the same file as last time?
#'
#' @description
#' Whole file snapshot testing is designed for testing objects that don't have
Expand Down
2 changes: 1 addition & 1 deletion R/snapshot-manage.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Snapshot management
#' Accept or reject modified snapshots
#'
#' * `snapshot_accept()` accepts all modified snapshots.
#' * `snapshot_review()` opens a Shiny app that shows a visual diff of each
Expand Down
2 changes: 1 addition & 1 deletion R/snapshot-value.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Snapshot testing for values
#' Do you expect this code to return the same value as last time?
#'
#' Captures the result of function, flexibly serializing it into a text
#' representation that's stored in a snapshot file. See [expect_snapshot()]
Expand Down
2 changes: 1 addition & 1 deletion R/snapshot.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Snapshot testing
#' Do you expect this code to run the same way as last time?
#'
#' @description
#' Snapshot tests (aka golden tests) are similar to unit tests except that the
Expand Down
2 changes: 1 addition & 1 deletion R/test-compiled-code.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ run_cpp_tests <- function(package) {
}
}

#' Use Catch for C++ Unit Testing
#' Use Catch for C++ unit testing
#'
#' Add the necessary infrastructure to enable C++ unit testing
#' in \R packages with [Catch](https://github.com/catchorg/Catch2) and
Expand Down
2 changes: 1 addition & 1 deletion R/test-state.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' State inspected
#' Check for global state changes
#'
#' @description
#' One of the most pernicious challenges to debug is when a test runs fine
Expand Down
2 changes: 1 addition & 1 deletion R/try-again.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Try evaluating an expressing multiple times until it succeeds
#' Evaluate an expression multiple times until it succeeds
#'
#' If you have a flaky test, you can use `try_again()` to run it a few times
#' until it succeeds. In most cases, you are better fixing the underlying
Expand Down
Loading
Loading