Skip to content

Commit 23b26bc

Browse files
authored
Merge pull request #1063 from tidyverse/f-rlang-1
- Require rlang 1.0.1 and pillar 1.7.0 (#1063).
2 parents fb17115 + f09cee8 commit 23b26bc

File tree

17 files changed

+2317
-309
lines changed

17 files changed

+2317
-309
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ Imports:
3434
lifecycle (>= 1.0.0),
3535
magrittr,
3636
methods,
37-
pillar (>= 1.6.2),
37+
pillar (>= 1.7.0),
3838
pkgconfig,
39-
rlang (>= 0.4.3),
39+
rlang (>= 1.0.1),
4040
utils,
4141
vctrs (>= 0.3.8)
4242
Suggests:

tests/testthat/_snaps/add.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# output test
2+
3+
Code
4+
add_row(tibble(), a = 1)
5+
Condition
6+
Error:
7+
! New rows can't add columns.
8+
x Can't find column `a` in `.data`.
9+
Code
10+
add_row(tibble(), a = 1, b = 2)
11+
Condition
12+
Error:
13+
! New rows can't add columns.
14+
x Can't find columns `a` and `b` in `.data`.
15+
Code
16+
add_row(tibble(), a = "a", b = "b", c = "c", d = "d", e = "e", f = "f", g = "g",
17+
h = "h", i = "i", j = "j", k = "k", l = "l", m = "m", n = "n", o = "o", p = "p",
18+
q = "q", r = "r", s = "s", t = "t", u = "u", v = "v", w = "w", x = "x", y = "y",
19+
z = "z")
20+
Condition
21+
Error:
22+
! New rows can't add columns.
23+
x Can't find columns `a`, `b`, `c`, `d`, `e`, and 21 more in `.data`.
24+
Code
25+
add_row(dplyr::group_by(tibble(a = 1), a))
26+
Condition
27+
Error:
28+
! Can't add rows to grouped data frames.
29+
Code
30+
add_row(tibble(a = 1), a = 2, .before = 1, .after = 1)
31+
Condition
32+
Error:
33+
! Can't specify both `.before` and `.after`.
34+
Code
35+
add_column(tibble(a = 1), a = 1)
36+
Condition
37+
Error:
38+
! Column name `a` must not be duplicated.
39+
Use .name_repair to specify repair.
40+
Caused by error in `stop_vctrs()`:
41+
! Names must be unique.
42+
x These names are duplicated:
43+
* "a" at locations 1 and 2.
44+
Code
45+
add_column(tibble(a = 1, b = 2), a = 1, b = 2)
46+
Condition
47+
Error:
48+
! Column names `a` and `b` must not be duplicated.
49+
Use .name_repair to specify repair.
50+
Caused by error in `stop_vctrs()`:
51+
! Names must be unique.
52+
x These names are duplicated:
53+
* "a" at locations 1 and 3.
54+
* "b" at locations 2 and 4.
55+
Code
56+
add_column(tibble(a = "a", b = "b", c = "c", d = "d", e = "e", f = "f", g = "g",
57+
h = "h", i = "i", j = "j", k = "k", l = "l", m = "m", n = "n", o = "o", p = "p",
58+
q = "q", r = "r", s = "s", t = "t", u = "u", v = "v", w = "w", x = "x", y = "y",
59+
z = "z"), a = "a", b = "b", c = "c", d = "d", e = "e", f = "f", g = "g", h = "h",
60+
i = "i", j = "j", k = "k", l = "l", m = "m", n = "n", o = "o", p = "p", q = "q",
61+
r = "r", s = "s", t = "t", u = "u", v = "v", w = "w", x = "x", y = "y", z = "z")
62+
Condition
63+
Error:
64+
! Column names `a`, `b`, `c`, `d`, `e`, and 21 more must not be duplicated.
65+
Use .name_repair to specify repair.
66+
Caused by error in `stop_vctrs()`:
67+
! Names must be unique.
68+
x These names are duplicated:
69+
* "a" at locations 1 and 27.
70+
* "b" at locations 2 and 28.
71+
* "c" at locations 3 and 29.
72+
* "d" at locations 4 and 30.
73+
* "e" at locations 5 and 31.
74+
* ...
75+
Code
76+
add_column(tibble(a = 2:3), b = 4:6)
77+
Condition
78+
Error:
79+
! New columns must be compatible with `.data`.
80+
x New column has 3 rows.
81+
i `.data` has 2 rows.
82+
Code
83+
add_column(tibble(a = 1), b = 1, .before = 1, .after = 1)
84+
Condition
85+
Error:
86+
! Can't specify both `.before` and `.after`.
87+

tests/testthat/_snaps/as_tibble.md

Lines changed: 146 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,171 @@
1-
# as_tibble() implements unique names
1+
# output test
22

33
Code
4-
invalid_df <- as_tibble(list(3, 4, 5), .name_repair = "unique")
5-
Message <rlib_message_name_repair>
6-
New names:
7-
* `` -> `...1`
8-
* `` -> `...2`
9-
* `` -> `...3`
10-
11-
# as_tibble() implements universal names
12-
4+
as_tibble(list(1))
5+
Condition
6+
Error:
7+
! Column 1 must be named.
8+
Use .name_repair to specify repair.
9+
Caused by error in `stop_vctrs()`:
10+
! Names can't be empty.
11+
x Empty name found at location 1.
1312
Code
14-
invalid_df <- as_tibble(list(3, 4, 5), .name_repair = "universal")
15-
Message <rlib_message_name_repair>
16-
New names:
17-
* `` -> `...1`
18-
* `` -> `...2`
19-
* `` -> `...3`
20-
21-
# as_tibble.matrix() supports .name_repair
22-
13+
as_tibble(list(1, 2))
14+
Condition
15+
Error:
16+
! Columns 1 and 2 must be named.
17+
Use .name_repair to specify repair.
18+
Caused by error in `stop_vctrs()`:
19+
! Names can't be empty.
20+
x Empty names found at locations 1 and 2.
2321
Code
24-
universal <- as_tibble(x, .name_repair = "universal")
25-
Message <rlib_message_name_repair>
26-
New names:
27-
* `` -> `...1`
28-
* `` -> `...2`
29-
30-
---
31-
22+
as_tibble(list(a = 1, 2))
23+
Condition
24+
Error:
25+
! Column 2 must be named.
26+
Use .name_repair to specify repair.
27+
Caused by error in `stop_vctrs()`:
28+
! Names can't be empty.
29+
x Empty name found at location 2.
3230
Code
33-
universal <- as_tibble(x, .name_repair = "universal")
34-
Message <rlib_message_name_repair>
35-
New names:
36-
* `if` -> `.if`
37-
38-
# as_tibble.poly() supports .name_repair
39-
31+
as_tibble(as.list(1:26))
32+
Condition
33+
Error:
34+
! Columns 1, 2, 3, 4, 5, and 21 more must be named.
35+
Use .name_repair to specify repair.
36+
Caused by error in `stop_vctrs()`:
37+
! Names can't be empty.
38+
x Empty names found at locations 1, 2, 3, 4, 5, etc.
4039
Code
41-
universal <- as_tibble(x, .name_repair = "universal")
42-
Message <rlib_message_name_repair>
43-
New names:
44-
* `1` -> `...1`
45-
* `2` -> `...2`
46-
* `3` -> `...3`
47-
48-
# as_tibble.table() supports .name_repair
49-
40+
as_tibble(set_names(list(1), "..1"))
41+
Condition
42+
Error:
43+
! Column 1 must not have names of the form ... or ..j.
44+
Use .name_repair to specify repair.
45+
Caused by error in `stop_vctrs()`:
46+
! Names can't be of the form `...` or `..j`.
47+
x These names are invalid:
48+
* "..1" at location 1.
49+
Code
50+
as_tibble(set_names(list(1:26), paste0("..", 1:26)))
51+
Condition
52+
Error in `set_names()`:
53+
! The size of `nm` (26) must be compatible with the size of `x` (1).
54+
Code
55+
as_tibble(list(a = 1, a = 1))
56+
Condition
57+
Error:
58+
! Column name `a` must not be duplicated.
59+
Use .name_repair to specify repair.
60+
Caused by error in `stop_vctrs()`:
61+
! Names must be unique.
62+
x These names are duplicated:
63+
* "a" at locations 1 and 2.
5064
Code
51-
as_tibble(table(a = c(1, 1, 1, 2, 2, 2), a = c(3, 4, 5, 3, 4, 5)))
52-
Error <tibble_error_column_names_must_be_unique>
53-
Column name `a` must not be duplicated.
65+
as_tibble(list(a = 1, a = 1, b = 1, b = 1))
66+
Condition
67+
Error:
68+
! Column names `a` and `b` must not be duplicated.
5469
Use .name_repair to specify repair.
5570
Caused by error in `stop_vctrs()`:
5671
! Names must be unique.
5772
x These names are duplicated:
5873
* "a" at locations 1 and 2.
74+
* "b" at locations 3 and 4.
5975
Code
60-
as_tibble(table(c(1, 1, 1, 2, 2, 2), c(3, 4, 5, 3, 4, 5)))
61-
Error <tibble_error_column_names_cannot_be_empty>
62-
Columns 1 and 2 must be named.
76+
as_tibble(list(a = new_environment()))
77+
Condition
78+
Error:
79+
! All columns in a tibble must be vectors.
80+
x Column `a` is an environment.
81+
Code
82+
as_tibble_row(list(1))
83+
Condition
84+
Error:
85+
! Column 1 must be named.
86+
Use .name_repair to specify repair.
87+
Caused by error in `stop_vctrs()`:
88+
! Names can't be empty.
89+
x Empty name found at location 1.
90+
Code
91+
as_tibble_row(list(1, 2))
92+
Condition
93+
Error:
94+
! Columns 1 and 2 must be named.
6395
Use .name_repair to specify repair.
6496
Caused by error in `stop_vctrs()`:
6597
! Names can't be empty.
6698
x Empty names found at locations 1 and 2.
67-
68-
---
69-
7099
Code
71-
universal <- as_tibble(x, .name_repair = "universal")
72-
Message <rlib_message_name_repair>
73-
New names:
74-
* `a` -> `a...1`
75-
* `a` -> `a...2`
76-
77-
---
78-
100+
as_tibble_row(list(a = 1, 2))
101+
Condition
102+
Error:
103+
! Column 2 must be named.
104+
Use .name_repair to specify repair.
105+
Caused by error in `stop_vctrs()`:
106+
! Names can't be empty.
107+
x Empty name found at location 2.
79108
Code
80-
universal <- as_tibble(x, .name_repair = "universal")
81-
Message <rlib_message_name_repair>
82-
New names:
83-
* `if` -> `.if`
84-
85-
---
86-
109+
as_tibble_row(as.list(1:26))
110+
Condition
111+
Error:
112+
! Columns 1, 2, 3, 4, 5, and 21 more must be named.
113+
Use .name_repair to specify repair.
114+
Caused by error in `stop_vctrs()`:
115+
! Names can't be empty.
116+
x Empty names found at locations 1, 2, 3, 4, 5, etc.
87117
Code
88-
universal <- as_tibble(x, .name_repair = "universal")
89-
Message <rlib_message_name_repair>
90-
New names:
91-
* `n` -> `n...2`
92-
* `n` -> `n...3`
93-
94-
# as_tibble.ts() supports .name_repair, minimal by default (#537)
95-
118+
as_tibble_row(set_names(list(1), "..1"))
119+
Condition
120+
Error:
121+
! Column 1 must not have names of the form ... or ..j.
122+
Use .name_repair to specify repair.
123+
Caused by error in `stop_vctrs()`:
124+
! Names can't be of the form `...` or `..j`.
125+
x These names are invalid:
126+
* "..1" at location 1.
96127
Code
97-
universal <- as_tibble(x, .name_repair = "universal")
98-
Message <rlib_message_name_repair>
99-
New names:
100-
* `` -> `...1`
101-
* `` -> `...2`
102-
103-
---
104-
128+
as_tibble_row(set_names(list(1:26), paste0("..", 1:26)))
129+
Condition
130+
Error in `set_names()`:
131+
! The size of `nm` (26) must be compatible with the size of `x` (1).
105132
Code
106-
universal <- as_tibble(x, .name_repair = "universal")
107-
Message <rlib_message_name_repair>
108-
New names:
109-
* `if` -> `.if`
110-
111-
# creates col names with name repair
112-
133+
as_tibble_row(list(a = 1, a = 1))
134+
Condition
135+
Error:
136+
! Column name `a` must not be duplicated.
137+
Use .name_repair to specify repair.
138+
Caused by error in `stop_vctrs()`:
139+
! Names must be unique.
140+
x These names are duplicated:
141+
* "a" at locations 1 and 2.
113142
Code
114-
out <- as_tibble(x, .name_repair = "unique")
115-
Message <rlib_message_name_repair>
116-
New names:
117-
* `` -> `...1`
118-
* `` -> `...2`
119-
120-
---
121-
143+
as_tibble_row(list(a = 1, a = 1, b = 1, b = 1))
144+
Condition
145+
Error:
146+
! Column names `a` and `b` must not be duplicated.
147+
Use .name_repair to specify repair.
148+
Caused by error in `stop_vctrs()`:
149+
! Names must be unique.
150+
x These names are duplicated:
151+
* "a" at locations 1 and 2.
152+
* "b" at locations 3 and 4.
153+
Code
154+
as_tibble_row(list(a = new_environment()))
155+
Condition
156+
Error in `stop_vctrs()`:
157+
! Input must be a vector, not an environment.
158+
Code
159+
as_tibble_row(list(a = 1:3))
160+
Condition
161+
Error:
162+
! All elements must be size one, use `list()` to wrap.
163+
x Element `a` is of size 3.
122164
Code
123-
out <- as_tibble(x, .name_repair = "universal")
124-
Message <rlib_message_name_repair>
125-
New names:
126-
* `` -> `...1`
127-
* `` -> `...2`
165+
as_tibble_row(list(a = 1:3, b = 1:3))
166+
Condition
167+
Error:
168+
! All elements must be size one, use `list()` to wrap.
169+
x Element `a` is of size 3.
170+
x Element `b` is of size 3.
128171

0 commit comments

Comments
 (0)