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

format.mismatch_character produces warning and erroneous output when there are many differences #513

Closed
brodieG opened this issue Aug 6, 2016 · 0 comments
Labels
bug an unexpected problem or unintended behavior expectation 🙀
Milestone

Comments

@brodieG
Copy link
Contributor

brodieG commented Aug 6, 2016

An example:

> library(testthat)
Warning message:
package ‘testthat’ was built under R version 3.2.5 
> expect_equal(letters[1:6], LETTERS[1:6])
Error: letters[1:6] not equal to LETTERS[1:6].
6/6 mismatches
x[1]: "a"
y[1]: "A"

x[2]: "b"
y[2]: "B"

x[3]: "c"
y[3]: "C"

x[4]: "d"
y[4]: "D"

x[5]: "e"
y[5]: "E"

x[6]: "a"
y[6]: "A"
In addition: Warning messages:
1: In mapply(FUN = f, ..., SIMPLIFY = FALSE) :
  longer argument not a multiple of length of shorter
2: In mapply(FUN = f, ..., SIMPLIFY = FALSE) :
  longer argument not a multiple of length of shorter

Notice that in addition to the warnings, the first 5 elements of the two vectors are being recycled (see x[6] and y[6]).

The problem is in format.mismatch_character, where anytime there are more differences than max_diffs (currently defaults to 5), show_x, show_y, and x$i are no longer the same lengths in the Map call.

Let me know if you want me to submit a PR to fix this, assuming you agree with what I laid out above.

@hadley hadley added bug an unexpected problem or unintended behavior expectation 🙀 labels Dec 15, 2016
@hadley hadley modified the milestone: 1.1.0 Dec 16, 2016
@hadley hadley closed this as completed in 2b715de Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior expectation 🙀
Projects
None yet
Development

No branches or pull requests

2 participants