brodieG / diffobj

Compare R Objects with a Diff
229 stars 12 forks source link

“wrong sign in by argument” for identical input and ANSI formatting #135

Closed flying-sheep closed 5 years ago

flying-sheep commented 5 years ago
diffobj::diffChr(
    'A Time Series:\n[1] 1 2 3 4',
    'A Time Series:\n[1] 1 2 3 4',
    format = 'ansi256',
    ignore.white.space = FALSE,
    interactive = FALSE)
Error in seq.default(dots[[1L]][[1L]], dots[[2L]][[1L]], by = dots[[3L]][[1L]]) : 
  wrong sign in 'by' argument 
13. stop("wrong sign in 'by' argument") 
12. seq.default(dots[[1L]][[1L]], dots[[2L]][[1L]], by = dots[[3L]][[1L]]) 
11. (function (...) UseMethod("seq"))(dots[[1L]][[1L]], dots[[2L]][[1L]], by = dots[[3L]][[1L]]) 
10. mapply(FUN = f, ..., SIMPLIFY = FALSE) 
9.  Map(seq, c(1L, head(tar.ends, -1L) + 1L), tar.ends, by = 1L) 
8.  word_to_line_map(hunks.flat, tar.dat, cur.dat, tar.ends, cur.ends, 
    tar.ind, cur.ind) 
7.  diff_word2(tar.dat.sub, cur.dat.sub, tar.ind = tar.rh, cur.ind = cur.rh, 
    diff.mode = "wrap", warn = warn, etc = etc) 
6.  line_diff(target, current, html_ent_sub(tar.capt, etc@style), 
    html_ent_sub(cur.capt, etc@style), etc = etc) 
5.  capt_fun(target, current, etc = etc.proc, err = err, extra) 
4.  .local(target, current, ...) 
3.  diffobj::diffChr(object, expected, format = "ansi256", ignore.white.space = FALSE, 
    interactive = FALSE) 
2.  diffobj::diffChr(object, expected, format = "ansi256", ignore.white.space = FALSE, 
    interactive = FALSE) 
1.  expect_id_text(repr_text(as.ts(1:4)), "A Time Series:\n[1] 1 2 3 4") 
brodieG commented 5 years ago

Thanks for the report. I'll be looking at this in the near future (1-2 weeks). Newline seems to cause the problem, though obviously it shouldn't.

flying-sheep commented 5 years ago

Grand. For the time being i just switched to if (!identical(a, b)) { ... } which makes my tests run again.

Thank you for this package! It makes testthat so much nicer to use than the builtin output: https://github.com/IRkernel/repr/blob/master/tests/testthat/helpers.r

brodieG commented 5 years ago

Great, also, fyi, testthat is planning on adding pluggable comparisons at some point.

flying-sheep commented 5 years ago

Yeah, probably as a reaction to (or inspired by) my issue there: r-lib/testthat#852

brodieG commented 5 years ago

I think this is mostly fixed, but I ran into some issues in a fairly gnarly part of the code and didn't get to finish it this weekend. Hopefully this will be done in the next week or so.

brodieG commented 5 years ago

Are you the maintainer for repr? I'm seeing some failures on revdep checks, but those failures seem to be also happening in the current CRAN version. I'm guessing they are not caused by diffobj, but diffobj is involved in the display of the failures, so I am not certain.

brodieG commented 5 years ago

I am not certain this is the reason, but I suspect the new pillar 1.4.0 release is breaking things with changes in behavior of type_sum. @flying-sheep

flying-sheep commented 5 years ago

yes! sorry that you had to investigate, I’m aware of this and just need to release a new version.

thank you also for fixing diffobj :smile: