Skip to content

Commit f1778e3

Browse files
Apply new air table formatting for tribble (#2940)
1 parent 0f29e3b commit f1778e3

2 files changed

Lines changed: 49 additions & 62 deletions

File tree

air.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[format]
2-
skip = ["tribble"]
2+
table = ["tribble"]

tests/testthat/test-topics.R

Lines changed: 48 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ select_topics_ <- function(topic, topics, check = TRUE) {
1010
}
1111

1212
test_that("bad inputs give informative warnings", {
13-
# fmt: skip
1413
topics <- tibble::tribble(
15-
~name, ~alias, ~internal, ~concepts,
16-
"x", c("x", "x1"), FALSE, character(),
14+
~name , ~alias , ~internal , ~concepts ,
15+
"x" , c("x", "x1") , FALSE , character() ,
1716
)
1817

1918
expect_snapshot(error = TRUE, {
@@ -28,10 +27,9 @@ test_that("bad inputs give informative warnings", {
2827
})
2928

3029
test_that("selector functions validate their inputs", {
31-
# fmt: skip
3230
topics <- tibble::tribble(
33-
~name, ~alias, ~internal, ~concepts,
34-
"x", c("x", "x1"), FALSE, character(),
31+
~name , ~alias , ~internal , ~concepts ,
32+
"x" , c("x", "x1") , FALSE , character() ,
3533
)
3634

3735
expect_snapshot(error = TRUE, {
@@ -42,23 +40,21 @@ test_that("selector functions validate their inputs", {
4240

4341

4442
test_that("empty input returns empty vector", {
45-
# fmt: skip
4643
topics <- tibble::tribble(
47-
~name, ~alias, ~internal, ~concepts,
48-
"x", c("x", "x1"), FALSE, character(),
44+
~name , ~alias , ~internal , ~concepts ,
45+
"x" , c("x", "x1") , FALSE , character() ,
4946
)
5047

5148
expect_equal(select_topics(character(), topics), integer())
5249
})
5350

5451
test_that("can select by name or alias", {
55-
# fmt: skip
5652
topics <- tibble::tribble(
57-
~name, ~alias,
58-
"x", c("a1", "a2"),
59-
"a", c("a3"),
60-
"a-b", "b-a",
61-
"c::d", "d",
53+
~name , ~alias ,
54+
"x" , c("a1", "a2") ,
55+
"a" , c("a3") ,
56+
"a-b" , "b-a" ,
57+
"c::d" , "d" ,
6258
)
6359

6460
expect_equal(select_topics_("x", topics), 1)
@@ -79,25 +75,23 @@ test_that("can select by name or alias", {
7975
})
8076

8177
test_that("selection preserves original order", {
82-
# fmt: skip
8378
topics <- tibble::tribble(
84-
~name, ~alias,
85-
"x", c("a1", "a2"),
86-
"a", c("a3"),
87-
"b", "b1"
79+
~name , ~alias ,
80+
"x" , c("a1", "a2") ,
81+
"a" , c("a3") ,
82+
"b" , "b1"
8883
)
8984

9085
expect_equal(select_topics_(c("a", "b1", "x"), topics), c(2, 3, 1))
9186
})
9287

9388
test_that("can select by name", {
94-
# fmt: skip
9589
topics <- tibble::tribble(
96-
~name, ~alias, ~internal,
97-
"a", "a", FALSE,
98-
"b1", "b1", FALSE,
99-
"b2", "b2", FALSE,
100-
"b3", "b3", TRUE,
90+
~name , ~alias , ~internal ,
91+
"a" , "a" , FALSE ,
92+
"b1" , "b1" , FALSE ,
93+
"b2" , "b2" , FALSE ,
94+
"b3" , "b3" , TRUE ,
10195
)
10296
topics$alias <- as.list(topics$alias)
10397

@@ -112,12 +106,11 @@ test_that("can select by name", {
112106
})
113107

114108
test_that("can select by presense or absence of concept", {
115-
# fmt: skip
116109
topics <- tibble::tribble(
117-
~name, ~alias, ~internal, ~concepts,
118-
"b1", "b1", FALSE, "a",
119-
"b2", "b2", FALSE, c("a", "b"),
120-
"b3", "b3", FALSE, character()
110+
~name , ~alias , ~internal , ~concepts ,
111+
"b1" , "b1" , FALSE , "a" ,
112+
"b2" , "b2" , FALSE , c("a", "b") ,
113+
"b3" , "b3" , FALSE , character()
121114
)
122115
topics$alias <- as.list(topics$alias)
123116

@@ -127,11 +120,10 @@ test_that("can select by presense or absence of concept", {
127120
})
128121

129122
test_that("can select by keyword", {
130-
# fmt: skip
131123
topics <- tibble::tribble(
132-
~name, ~alias, ~internal, ~keywords,
133-
"b1", "b1", FALSE, "a",
134-
"b2", "b2", FALSE, c("a", "b"),
124+
~name , ~alias , ~internal , ~keywords ,
125+
"b1" , "b1" , FALSE , "a" ,
126+
"b2" , "b2" , FALSE , c("a", "b") ,
135127
)
136128
topics$alias <- as.list(topics$alias)
137129
expect_equal(select_topics_("has_keyword('a')", topics), c(1, 2))
@@ -143,11 +135,10 @@ test_that("can select by keyword", {
143135
})
144136

145137
test_that("can select by lifecycle", {
146-
# fmt: skip
147138
topics <- tibble::tribble(
148-
~name, ~alias, ~internal, ~keywords, ~lifecycle,
149-
"b1", "b1", FALSE, "a", list("stable"),
150-
"b2", "b2", FALSE, c("a", "b"), NULL
139+
~name , ~alias , ~internal , ~keywords , ~lifecycle ,
140+
"b1" , "b1" , FALSE , "a" , list("stable") ,
141+
"b2" , "b2" , FALSE , c("a", "b") , NULL
151142
)
152143
expect_equal(select_topics_("has_lifecycle('stable')", topics), 1)
153144
expect_equal(
@@ -157,13 +148,12 @@ test_that("can select by lifecycle", {
157148
})
158149

159150
test_that("can combine positive and negative selections", {
160-
# fmt: skip
161151
topics <- tibble::tribble(
162-
~name, ~alias, ~internal,
163-
"x", c("a1", "a2"), FALSE,
164-
"a", c("a3"), FALSE,
165-
"b", "b1", FALSE,
166-
"d", "d", TRUE,
152+
~name , ~alias , ~internal ,
153+
"x" , c("a1", "a2") , FALSE ,
154+
"a" , c("a3") , FALSE ,
155+
"b" , "b1" , FALSE ,
156+
"d" , "d" , TRUE ,
167157
)
168158
expect_equal(select_topics_("-x", topics), c(2, 3))
169159
expect_equal(select_topics_(c("-x", "-a"), topics), 3)
@@ -174,13 +164,12 @@ test_that("can combine positive and negative selections", {
174164
})
175165

176166
test_that("an unmatched selection generates a warning", {
177-
# fmt: skip
178167
topics <- tibble::tribble(
179-
~name, ~alias, ~internal,
180-
"x", c("a1", "a2"), FALSE,
181-
"a", c("a3"), FALSE,
182-
"b", "b1", FALSE,
183-
"d", "d", TRUE,
168+
~name , ~alias , ~internal ,
169+
"x" , c("a1", "a2") , FALSE ,
170+
"a" , c("a3") , FALSE ,
171+
"b" , "b1" , FALSE ,
172+
"d" , "d" , TRUE ,
184173
)
185174

186175
expect_snapshot(
@@ -191,11 +180,10 @@ test_that("an unmatched selection generates a warning", {
191180

192181
test_that("uses funs or aliases", {
193182
pkg <- local_pkgdown_site()
194-
# fmt: skip
195183
pkg$topics <- tibble::tribble(
196-
~name, ~funs, ~alias, ~file_out, ~title, ~lifecycle,
197-
"x", character(), c("x1", "x2"), "x.html", "X", NULL,
198-
"y", c("y1", "y2"), "y3", "y.html", "Y", NULL
184+
~name , ~funs , ~alias , ~file_out , ~title , ~lifecycle ,
185+
"x" , character() , c("x1", "x2") , "x.html" , "X" , NULL ,
186+
"y" , c("y1", "y2") , "y3" , "y.html" , "Y" , NULL
199187
)
200188

201189
out <- section_topics(pkg, c("x", "y"), error_path = "reference[1].contents")
@@ -223,13 +211,12 @@ test_that("full topic selection process works", {
223211
})
224212

225213
test_that("an unmatched selection with a matched selection does not select everything", {
226-
# fmt: skip
227214
topics <- tibble::tribble(
228-
~name, ~alias, ~internal,
229-
"x", c("a1", "a2"), FALSE,
230-
"a", c("a3"), FALSE,
231-
"b", "b1", FALSE,
232-
"d", "d", TRUE,
215+
~name , ~alias , ~internal ,
216+
"x" , c("a1", "a2") , FALSE ,
217+
"a" , c("a3") , FALSE ,
218+
"b" , "b1" , FALSE ,
219+
"d" , "d" , TRUE ,
233220
)
234221

235222
expect_equal(

0 commit comments

Comments
 (0)