unitizer (version 1.4.5)

all.equal.condition: Compare Conditions

Description

Tests that issue warnings or `stop` produce condition objects. The functions documented here are specialized versions of all.equal designed specifically to compare conditions and condition lists produced during unitizer test evaluations. conditionList objects are lists of conditions that come about when test expressions emit multiple conditions (e.g. more than one warning).

Usage

# S4 method for conditionList,ANY
all.equal(target, current, ...)

# S3 method for equal.conditionList all(target, current, ...)

# S3 method for equal.condition all(target, current, ...)

Arguments

target

the list of conditions that we are matching against

current

the list of conditions we are checking

...

provided for compatibility with generic

Value

TRUE if the (lists of) conditions are equivalent, a character vector explaining why they are not otherwise

Details

condition objects produced by tests have one additional attributed “printed” which disambiguates whether a condition was the result of the test expression, or the print / show method used to display it to screen.

For conditionList objects, these methods only return TRUE if all conditions are pairwise all.equal.

Examples

Run this code
# NOT RUN {
cond.1 <- simpleWarning('hello world')
cond.2 <- simpleError('hello world')
cond.3 <- simpleError('goodbye world')
all.equal(cond.1, cond.1)
all.equal(cond.1, cond.2)
all.equal(cond.2, cond.3)
## Normally you would never actually create a `conditionList` yourself; these
## are automatically generated by `unitizer` for review at the `unitizer`
## prompt
all.equal(
  conditionList(.items=list(cond.1, cond.2)),
  conditionList(.items=list(cond.1, cond.3))
)
# }

Run the code above in your browser using DataCamp Workspace