Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expect_equal does not print values of vectors when sizes differ #1931

Closed
levsa opened this issue Feb 14, 2024 · 1 comment
Closed

expect_equal does not print values of vectors when sizes differ #1931

levsa opened this issue Feb 14, 2024 · 1 comment

Comments

@levsa
Copy link

levsa commented Feb 14, 2024

It would be nice if expect_equal printed the values even when sizes differ. Example:

> a <- c(1)
> b <- c(2,3)
> testthat::expect_equal(a,b)
Error: `a` not equal to `b`.
Lengths differ: 1 is not 2
@hadley
Copy link
Member

hadley commented Apr 17, 2024

You should switch to the 3rd edition where this looks much better 😄

a <- c(1)
b <- c(2,3)

testthat::local_edition(3)
testthat::expect_equal(a,b)
#> Error: `a` (`actual`) not equal to `b` (`expected`).
#> 
#>   `actual`: 1  
#> `expected`: 2 3

Created on 2024-04-17 with reprex v2.1.0

More info about the 3rd ed at https://testthat.r-lib.org/articles/third-edition.html

@hadley hadley closed this as completed Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants