Documentation for expect_error argument 'regexp' says it accepts a character vector but it does not
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start with the documentation for testthat::expect_error() and reproduce the reported character-vector example in R. Check whether the documented vector behavior is intended; done means either the documentation accurately describes the accepted regexp input or the behavior and its tests support the documented vector form.
Written by the indexing model from the issue text.
Description
The documentation reads:
regexp
Regular expression to test against.
- A character vector giving a regular expression that must match the error message.
Yetexpect_error(object = x, regexp = c('foo', 'bar')) does not work.
Repex:
f <- function(x){
foo <- 'foo is not '
stop(foo, x)
}
testthat::test_that('expect_error() can use a character vector for regexp',{
expect_error(
object = f('bar'),
regexp = c('foo', 'bar')
)
})
# test fails because of an error in expect_error():
# Error in `expect_error(object = f("bar"), regexp = c("foo", "bar"))`: `regexp` must be a single string, `NA`, or `NULL`, not a character vector.
Is it intended for expect_error() to work with a regexp vector of patterns or should one always use a single pattern?
- Dominant language
- R
- Stars
- 939
- Forks
- 346
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from r-lib/testthat
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 3/5 1-2 days Newbie friendliness 66/100
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Similar issues
-
documentation pkg infrastructure
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
epiverse-trace/epiparameter#511 ·
-
function:write_dwc
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
beginners blocker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100