Skip to content

Commit 74a69a3

Browse files
Use expect_no_error over custom helper (#435)
1 parent b87d89e commit 74a69a3

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Suggests:
3737
mockr,
3838
rmarkdown,
3939
spelling,
40-
testthat (>= 3.1.3)
40+
testthat (>= 3.1.5)
4141
VignetteBuilder:
4242
knitr
4343
Config/Needs/website:

tests/testthat/helper.R

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ with_mock <- function(..., .parent = parent.frame()) {
1717
mockr::with_mock(..., .parent = .parent, .env = "googledrive")
1818
}
1919

20-
expect_error_free <- function(...) {
21-
expect_error(..., regexp = NA)
22-
}
23-
2420
# usage:
2521
# test_fixture("something.rds")
2622
test_fixture <- function(name) testthat::test_path("test-fixtures", name)

tests/testthat/test-drive_auth.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ test_that("drive_auth_configure works", {
55
drive_auth_configure(client = old_client, api_key = old_api_key)
66
)
77

8-
expect_error_free(drive_oauth_client())
9-
expect_error_free(drive_api_key())
8+
expect_no_error(drive_oauth_client())
9+
expect_no_error(drive_api_key())
1010

1111
expect_snapshot(
1212
drive_auth_configure(client = gargle::gargle_client(), path = "PATH"),

tests/testthat/test-drive_id-class.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test_that("presence of drive_id column doesn't prevent row binding of dribbles",
7272
alfa <- x[1:2, ]
7373
bravo <- x[3:4, ]
7474

75-
expect_error_free(
75+
expect_no_error(
7676
out <- vec_rbind(alfa, bravo)
7777
)
7878
expect_equal(out[c("name", "id")], x[1:4, c("name", "id")])
@@ -102,19 +102,19 @@ test_that("gargle_map_cli() is implemented for drive_id", {
102102

103103
## low-level helpers
104104
test_that("new_drive_id() handles 0-length input and NA", {
105-
expect_error_free(
105+
expect_no_error(
106106
out <- new_drive_id(character())
107107
)
108108
expect_length(out, 0)
109109
expect_true(is_drive_id(out))
110110

111-
expect_error_free(
111+
expect_no_error(
112112
out <- new_drive_id(NA_character_)
113113
)
114114
expect_true(is.na(out))
115115
expect_true(is_drive_id(out))
116116

117-
expect_error_free(
117+
expect_no_error(
118118
out <- new_drive_id(c(NA_character_, "abc"))
119119
)
120120
expect_true(is.na(out[1]))

tests/testthat/test-utils-paths.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ test_that("check_for_overwrite() does its job", {
171171
"already exist"
172172
)
173173

174-
expect_error_free(
174+
expect_no_error(
175175
second <- drive_create(
176176
me_("name-collision"),
177177
path = PARENT_ID,
@@ -185,7 +185,7 @@ test_that("check_for_overwrite() does its job", {
185185
)
186186
expect_false(first$id == second$id)
187187

188-
expect_error_free(
188+
expect_no_error(
189189
drive_create(
190190
me_("name-collision"),
191191
path = PARENT_ID,

0 commit comments

Comments
 (0)