Skip to content

Commit

Permalink
Use cross symbol for "can't" and "must" bullets (tidyverse#6137)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- authored Dec 22, 2021
1 parent e028371 commit cd851f4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions R/mutate.R
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ mutate_bullets.default <- function(cnd, ...) {
result_size <- cnd$dplyr_error_data$result_size
expected_size <- cnd$dplyr_error_data$expected_size
c(
i = glue("`{error_name}` must be size {or_1(expected_size)}, not {result_size}."),
x = glue("`{error_name}` must be size {or_1(expected_size)}, not {result_size}."),
i = cnd_bullet_rowwise_unlist(),
i = cnd_bullet_cur_group_label()
)
Expand All @@ -497,7 +497,7 @@ mutate_bullets.default <- function(cnd, ...) {
error_name <- peek_error_context()$error_name
c(
x = glue("`{error_name}` must return compatible vectors across groups."),
i = "Cannot combine NULL and non NULL results.",
x = "Can't combine NULL and non NULL results.",
i = cnd_bullet_rowwise_unlist()
)
}
Expand Down
2 changes: 1 addition & 1 deletion R/summarise.R
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ summarise_bullets.default <- function(cnd, ...) {
error_name <- peek_error_context()$error_name
c(
x = glue("`{error_name}` must return compatible vectors across groups."),
i = "Cannot combine NULL and non NULL results."
x = "Can't combine NULL and non NULL results."
)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/arrange.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Error in `arrange()`:
! Problem with the implicit `transmute()` step.
x Problem while computing `..1 = rep(x, 2)`.
i `..1` must be size 1, not 2.
x `..1` must be size 1, not 2.

# desc() inside arrange() checks the number of arguments (#5921)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,5 @@
Condition
Error in `my_verb()`:
! Problem while computing `.result = cyl * c(am, vs)`.
i `.result` must be size 32 or 1, not 64.
x `.result` must be size 32 or 1, not 64.

14 changes: 7 additions & 7 deletions tests/testthat/_snaps/mutate.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,30 +69,30 @@
Error in `mutate()`:
! Problem while computing `..1 = if (a == 1) NULL else "foo"`.
x `..1` must return compatible vectors across groups.
i Cannot combine NULL and non NULL results.
x Can't combine NULL and non NULL results.
Code
(expect_error(data.frame(x = c(2, 2, 3, 3)) %>% mutate(int = 1:5)))
Output
<error/dplyr:::mutate_error>
Error in `mutate()`:
! Problem while computing `int = 1:5`.
i `int` must be size 4 or 1, not 5.
x `int` must be size 4 or 1, not 5.
Code
(expect_error(data.frame(x = c(2, 2, 3, 3)) %>% group_by(x) %>% mutate(int = 1:
5)))
Output
<error/dplyr:::mutate_error>
Error in `mutate()`:
! Problem while computing `int = 1:5`.
i `int` must be size 2 or 1, not 5.
x `int` must be size 2 or 1, not 5.
i The error occurred in group 1: x = 2.
Code
(expect_error(data.frame(x = c(2, 3, 3)) %>% group_by(x) %>% mutate(int = 1:5)))
Output
<error/dplyr:::mutate_error>
Error in `mutate()`:
! Problem while computing `int = 1:5`.
i `int` must be size 1, not 5.
x `int` must be size 1, not 5.
i The error occurred in group 1: x = 2.
Code
(expect_error(data.frame(x = c(2, 2, 3, 3)) %>% rowwise() %>% mutate(int = 1:5))
Expand All @@ -101,7 +101,7 @@
<error/dplyr:::mutate_error>
Error in `mutate()`:
! Problem while computing `int = 1:5`.
i `int` must be size 1, not 5.
x `int` must be size 1, not 5.
i Did you mean: `int = list(1:5)` ?
i The error occurred in row 1.
Code
Expand All @@ -110,7 +110,7 @@
<error/dplyr:::mutate_error>
Error in `mutate()`:
! Problem while computing `y2 = y`.
i `y2` must be size 1, not 3.
x `y2` must be size 1, not 3.
i Did you mean: `y2 = list(y)` ?
i The error occurred in row 1.
Code
Expand All @@ -119,7 +119,7 @@
<error/dplyr:::mutate_error>
Error in `mutate()`:
! Problem while computing `y = 1:2`.
i `y` must be size 10 or 1, not 2.
x `y` must be size 10 or 1, not 2.
Code
(expect_error(tibble(a = 1) %>% mutate(c = .data$b)))
Output
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/summarise.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
Error in `summarise()`:
! Problem while computing `x = if (g == 1) 42`.
x `x` must return compatible vectors across groups.
i Cannot combine NULL and non NULL results.
x Can't combine NULL and non NULL results.
Code
(expect_error(summarise(mtcars, a = mean(not_there))))
Output
Expand Down

0 comments on commit cd851f4

Please sign in to comment.