Skip to content

Commit cf99ed5

Browse files
committed
Update snapshot tests for testthat 3.1.3
Relates to #388
1 parent b3952fb commit cf99ed5

21 files changed

+214
-144
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Suggests:
4141
roxygen2,
4242
sodium,
4343
spelling,
44-
testthat (>= 3.0.0)
44+
testthat (>= 3.1.3)
4545
VignetteBuilder:
4646
knitr
4747
Remotes:

tests/testthat/_snaps/dribble.md

+51-34
Original file line numberDiff line numberDiff line change
@@ -13,130 +13,147 @@
1313

1414
Code
1515
new_dribble(1:3)
16-
Error <simpleError>
17-
`x` must be a list
16+
Condition
17+
Error:
18+
! `x` must be a list
1819

1920
# validate_dribble() checks class, var names, var types
2021

2122
Code
2223
validate_dribble("a")
23-
Error <simpleError>
24-
inherits(x, "dribble") is not TRUE
24+
Condition
25+
Error in `validate_dribble()`:
26+
! inherits(x, "dribble") is not TRUE
2527

2628
---
2729

2830
Code
2931
validate_dribble(d)
30-
Error <rlang_error>
31-
Invalid <dribble>. This column has the wrong type:
32+
Condition
33+
Error in `validate_dribble()`:
34+
! Invalid <dribble>. This column has the wrong type:
3235
* `id`
3336

3437
---
3538

3639
Code
3740
validate_dribble(d)
38-
Error <rlang_error>
39-
Invalid <dribble>. These columns have the wrong type:
41+
Condition
42+
Error in `validate_dribble()`:
43+
! Invalid <dribble>. These columns have the wrong type:
4044
* `name`
4145
* `id`
4246

4347
---
4448

4549
Code
4650
validate_dribble(d)
47-
Error <rlang_error>
48-
Invalid <dribble>. This required column is missing:
51+
Condition
52+
Error in `validate_dribble()`:
53+
! Invalid <dribble>. This required column is missing:
4954
* `name`
5055

5156
---
5257

5358
Code
5459
validate_dribble(d)
55-
Error <rlang_error>
56-
Invalid <dribble>. These required columns are missing:
60+
Condition
61+
Error in `validate_dribble()`:
62+
! Invalid <dribble>. These required columns are missing:
5763
* `name`
5864
* `id`
5965

6066
---
6167

6268
Code
6369
validate_dribble(d)
64-
Error <rlang_error>
65-
Invalid <dribble>. Can't confirm `kind = "drive#file"` or `kind = "drive#drive"` for all elements of the `drive_resource` column.
70+
Condition
71+
Error in `validate_dribble()`:
72+
! Invalid <dribble>. Can't confirm `kind = "drive#file"` or `kind = "drive#drive"` for all elements of the `drive_resource` column.
6673

6774
# dribble nrow checkers work
6875

6976
Code
7077
confirm_single_file(d)
71-
Error <rlang_error>
72-
`d` does not identify at least one Drive file.
78+
Condition
79+
Error in `confirm_single_file()`:
80+
! `d` does not identify at least one Drive file.
7381

7482
---
7583

7684
Code
7785
confirm_some_files(d)
78-
Error <rlang_error>
79-
`d` does not identify at least one Drive file.
86+
Condition
87+
Error in `confirm_some_files()`:
88+
! `d` does not identify at least one Drive file.
8089

8190
---
8291

8392
Code
8493
confirm_single_file(d)
85-
Error <rlang_error>
86-
`d` identifies more than one Drive file.
94+
Condition
95+
Error in `confirm_single_file()`:
96+
! `d` identifies more than one Drive file.
8797

8898
# as_dribble() default method handles unsuitable input
8999

90100
Code
91101
as_dribble(1.3)
92-
Error <rlang_error>
93-
Don't know how to coerce an object of class <numeric> into a <dribble>.
102+
Condition
103+
Error in `as_dribble()`:
104+
! Don't know how to coerce an object of class <numeric> into a <dribble>.
94105

95106
---
96107

97108
Code
98109
as_dribble(TRUE)
99-
Error <rlang_error>
100-
Don't know how to coerce an object of class <logical> into a <dribble>.
110+
Condition
111+
Error in `as_dribble()`:
112+
! Don't know how to coerce an object of class <logical> into a <dribble>.
101113

102114
# as_dribble.list() catches bad input
103115

104116
Code
105117
as_dribble(list(drib_lst))
106-
Error <simpleError>
107-
map_lgl(x, ~all(required_nms %in% names(.x))) is not TRUE
118+
Condition
119+
Error in `as_dribble.list()`:
120+
! map_lgl(x, ~all(required_nms %in% names(.x))) is not TRUE
108121

109122
---
110123

111124
Code
112125
as_dribble(list(drib_lst))
113-
Error <rlang_error>
114-
Invalid <dribble>. Can't confirm `kind = "drive#file"` or `kind = "drive#drive"` for all elements of the `drive_resource` column.
126+
Condition
127+
Error in `validate_dribble()`:
128+
! Invalid <dribble>. Can't confirm `kind = "drive#file"` or `kind = "drive#drive"` for all elements of the `drive_resource` column.
115129

116130
# as_parent() throws specific errors
117131

118132
Code
119133
foo <- d[0, ]
120134
as_parent(foo)
121-
Error <rlang_error>
122-
Parent specified via `foo` is invalid:
135+
Condition
136+
Error in `as_parent()`:
137+
! Parent specified via `foo` is invalid:
123138
x Does not exist.
124139

125140
---
126141

127142
Code
128143
foo <- d
129144
as_parent(foo)
130-
Error <rlang_error>
131-
Parent specified via `foo` is invalid:
145+
Condition
146+
Error in `as_parent()`:
147+
! Parent specified via `foo` is invalid:
132148
x Doesn't uniquely identify exactly one folder or shared drive.
133149

134150
---
135151

136152
Code
137153
foo <- d[1, ]
138154
as_parent(foo)
139-
Error <rlang_error>
140-
Parent specified via `foo` is invalid:
155+
Condition
156+
Error in `as_parent()`:
157+
! Parent specified via `foo` is invalid:
141158
x Is neither a folder nor a shared drive.
142159

tests/testthat/_snaps/drive_auth.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Code
44
drive_auth_configure(app = gargle::gargle_app(), path = "PATH")
5-
Error <rlang_error>
6-
Must supply exactly one of `app` or `path`, not both
5+
Condition
6+
Error in `drive_auth_configure()`:
7+
! Must supply exactly one of `app` or `path`, not both
78

tests/testthat/_snaps/drive_cp.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@
2222

2323
Code
2424
drive_cp(file, nm_("i-am-a-folder"))
25-
Error <rlang_error>
26-
Unclear if `path` specifies parent folder or full path to the new file, including its name.
25+
Condition
26+
Error in `confirm_clear_path()`:
27+
! Unclear if `path` specifies parent folder or full path to the new file, including its name.
2728
See `?as_dribble()` for advice on how to make this clear.
2829

2930
# drive_cp() errors if asked to copy a folder
3031

3132
Code
3233
drive_cp(nm_("i-am-a-folder"))
33-
Error <rlang_error>
34-
The Drive API does not copy folders or shared drives.
34+
Condition
35+
Error in `drive_cp()`:
36+
! The Drive API does not copy folders or shared drives.
3537

3638
# drive_cp() takes name, assumes path is folder if both are specified
3739

@@ -48,15 +50,17 @@
4850
Code
4951
file_cp <- drive_cp(nm_("i-am-a-file"), path = nm_("file-name"), name = nm_(
5052
"file-name"))
51-
Error <rlang_error>
52-
Parent specified via `path` is invalid:
53+
Condition
54+
Error in `as_parent()`:
55+
! Parent specified via `path` is invalid:
5356
x Does not exist.
5457

5558
---
5659

5760
Code
5861
file_cp <- drive_cp(nm_("i-am-a-file"), append_slash(nm_("not-unique-folder")))
59-
Error <rlang_error>
60-
Parent specified via `path` is invalid:
62+
Condition
63+
Error in `as_parent()`:
64+
! Parent specified via `path` is invalid:
6165
x Doesn't uniquely identify exactly one folder or shared drive.
6266

tests/testthat/_snaps/drive_create.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,33 @@
22

33
Code
44
drive_create()
5-
Error <simpleError>
6-
argument "name" is missing, with no default
5+
Condition
6+
Error in `is_string()`:
7+
! argument "name" is missing, with no default
78

89
---
910

1011
Code
1112
drive_create(letters)
12-
Error <simpleError>
13-
is_string(name) is not TRUE
13+
Condition
14+
Error in `drive_create()`:
15+
! is_string(name) is not TRUE
1416

1517
# drive_create() errors if parent path does not exist
1618

1719
Code
1820
drive_create("a", path = "qweruiop")
19-
Error <rlang_error>
20-
Parent specified via `path` is invalid:
21+
Condition
22+
Error in `as_parent()`:
23+
! Parent specified via `path` is invalid:
2124
x Does not exist.
2225

2326
# drive_create() errors if parent exists but is not a folder
2427

2528
Code
2629
drive_create("a", path = x)
27-
Error <rlang_error>
28-
Parent specified via `path` is invalid:
30+
Condition
31+
Error in `as_parent()`:
32+
! Parent specified via `path` is invalid:
2933
x Is neither a folder nor a shared drive.
3034

tests/testthat/_snaps/drive_download.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
Code
44
withr::with_dir(tmpdir, drive_download(dribble(), path = precious_filepath))
5-
Error <rlang_error>
6-
Local `path` already exists and overwrite is `FALSE`:
5+
Condition
6+
Error in `drive_download()`:
7+
! Local `path` already exists and overwrite is `FALSE`:
78
* 'precious-TEST-drive_download.txt'
89

910
# drive_download() downloads a file and adds local_path column
@@ -20,8 +21,9 @@
2021

2122
Code
2223
drive_download(nm_("this-should-not-exist"))
23-
Error <rlang_error>
24-
`file` does not identify at least one Drive file.
24+
Condition
25+
Error in `confirm_single_file()`:
26+
! `file` does not identify at least one Drive file.
2527

2628
# drive_download() converts with explicit `type`
2729

tests/testthat/_snaps/drive_examples.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
Code
44
drive_example_remote("chicken")
5-
Error <rlang_error>
6-
Found multiple matching remote files:
5+
Condition
6+
Error in `one_file()`:
7+
! Found multiple matching remote files:
78
* 'chicken_doc'
89
* 'chicken_sheet'
910
* 'chicken.csv'
@@ -16,8 +17,9 @@
1617

1718
Code
1819
drive_example_local("chicken")
19-
Error <rlang_error>
20-
Found multiple matching local files:
20+
Condition
21+
Error in `one_file()`:
22+
! Found multiple matching local files:
2123
* 'chicken.csv'
2224
* 'chicken.jpg'
2325
* 'chicken.pdf'
@@ -28,6 +30,7 @@
2830

2931
Code
3032
drive_examples_local("platypus")
31-
Error <rlang_error>
32-
Can't find a local example file with a name that matches "platypus".
33+
Condition
34+
Error in `many_files()`:
35+
! Can't find a local example file with a name that matches "platypus".
3336

tests/testthat/_snaps/drive_fields.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
Code
44
out <- drive_fields(x, resource = "foo")
5-
Message <cliMessage>
5+
Message
66
! Currently only fields for the 'files' resource can be checked for validity.
77
Nothing done.
88

99
# drive_fields() detects bad fields
1010

1111
Code
1212
out <- drive_fields(c("name", "parents", "ownedByMe", "pancakes!"))
13-
Warning <rlang_warning>
13+
Condition
14+
Warning:
1415
Omitting fields that are not recognized as part of the Files resource:
1516
* 'pancakes!'
1617

tests/testthat/_snaps/drive_find.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22

33
Code
44
drive_find(n_max = "a")
5-
Error <simpleError>
6-
is.numeric(n_max) is not TRUE
5+
Condition
6+
Error in `drive_find()`:
7+
! is.numeric(n_max) is not TRUE
78

89
---
910

1011
Code
1112
drive_find(n_max = 1:3)
12-
Error <simpleError>
13-
length(n_max) == 1 is not TRUE
13+
Condition
14+
Error in `drive_find()`:
15+
! length(n_max) == 1 is not TRUE
1416

1517
---
1618

1719
Code
1820
drive_find(n_max = -2)
19-
Error <simpleError>
20-
n_max >= 0 is not TRUE
21+
Condition
22+
Error in `drive_find()`:
23+
! n_max >= 0 is not TRUE
2124

0 commit comments

Comments
 (0)