Skip to content

Commit 11dc98b

Browse files
committed
expect_condition_matching_
1 parent 625f05b commit 11dc98b

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

R/expect-condition.R

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ expect_error <- function(
115115
label = NULL
116116
) {
117117
if (edition_get() >= 3) {
118-
expect_condition_matching(
118+
expect_condition_matching_(
119119
"error",
120120
{{ object }},
121121
regexp = regexp,
@@ -163,7 +163,7 @@ expect_warning <- function(
163163
warn("The `all` argument is deprecated")
164164
}
165165

166-
expect_condition_matching(
166+
expect_condition_matching_(
167167
"warning",
168168
{{ object }},
169169
regexp = regexp,
@@ -208,7 +208,7 @@ expect_message <- function(
208208
label = NULL
209209
) {
210210
if (edition_get() >= 3) {
211-
expect_condition_matching(
211+
expect_condition_matching_(
212212
"message",
213213
{{ object }},
214214
regexp = regexp,
@@ -240,7 +240,7 @@ expect_condition <- function(
240240
label = NULL
241241
) {
242242
if (edition_get() >= 3) {
243-
expect_condition_matching(
243+
expect_condition_matching_(
244244
"condition",
245245
{{ object }},
246246
regexp = regexp,
@@ -273,7 +273,7 @@ expect_condition <- function(
273273
}
274274
}
275275

276-
expect_condition_matching <- function(
276+
expect_condition_matching_ <- function(
277277
base_class,
278278
object,
279279
regexp = NULL,
@@ -309,7 +309,12 @@ expect_condition_matching <- function(
309309
# Access error fields with `[[` rather than `$` because the
310310
# `$.Throwable` from the rJava package throws with unknown fields
311311
if (!is.null(msg)) {
312-
return(fail(msg, info = info, trace = act$cap[["trace"]], trace_env = trace_env))
312+
return(fail(
313+
msg,
314+
info = info,
315+
trace = act$cap[["trace"]],
316+
trace_env = trace_env
317+
))
313318
}
314319
# If a condition was expected, return it. Otherwise return the value
315320
# of the expression.

R/expect-self-test.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ expect_snapshot_skip <- function(x, cran = FALSE) {
138138
expect_snapshot_condition_("skip", x)
139139
}
140140
expect_skip <- function(code) {
141-
expect_condition(code, class = "skip")
141+
expect_condition_matching_("skip", code)
142142
}
143143
expect_no_skip <- function(code) {
144-
expect_no_condition(code, class = "skip")
144+
expect_no_("skip", code)
145145
}
146146

147147

tests/testthat/_snaps/reporter-progress.new.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
Backtrace:
307307
x
308308
1. +-testthat::expect_error(f(), "foo")
309-
2. | \-testthat:::expect_condition_matching(...)
309+
2. | \-testthat:::expect_condition_matching_(...)
310310
3. | \-testthat:::quasi_capture(...)
311311
4. | +-testthat (local) .capture(...)
312312
5. | | \-base::withCallingHandlers(...)
@@ -437,7 +437,7 @@
437437
Backtrace:
438438
x
439439
1. +-testthat::expect_error(f(), "foo")
440-
2. | \-testthat:::expect_condition_matching(...)
440+
2. | \-testthat:::expect_condition_matching_(...)
441441
3. | \-testthat:::quasi_capture(...)
442442
4. | +-testthat (local) .capture(...)
443443
5. | | \-base::withCallingHandlers(...)

0 commit comments

Comments
 (0)