Skip to content

Commit 5d8887d

Browse files
committed
More to expect_match()
1 parent 963e37b commit 5d8887d

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

R/expect-match.R

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,24 @@ expect_match <- function(
4646
check_bool(all)
4747

4848
if (length(object) == 0) {
49-
msg <- sprintf("Expected %s to have at least one element.", act$lab)
50-
fail(msg, info = info)
51-
return(invisible(act$val))
49+
fail(
50+
sprintf("Expected %s to have at least one element.", act$lab),
51+
info = info
52+
)
53+
} else {
54+
expect_match_(
55+
act = act,
56+
regexp = regexp,
57+
perl = perl,
58+
fixed = fixed,
59+
...,
60+
all = all,
61+
info = info,
62+
label = label,
63+
negate = FALSE
64+
)
5265
}
5366

54-
expect_match_(
55-
act = act,
56-
regexp = regexp,
57-
perl = perl,
58-
fixed = fixed,
59-
...,
60-
all = all,
61-
info = info,
62-
label = label,
63-
negate = FALSE
64-
)
6567
invisible(act$val)
6668
}
6769

0 commit comments

Comments
 (0)