brodieG / unitizer

Easy R Unit Tests
Other
39 stars 6 forks source link

Wrong non-test Displayed #276

Closed brodieG closed 2 years ago

brodieG commented 3 years ago

Seeing:

unitizer> Y

> string2 <- "012345678901234"
> tce(strwrap_ctl(string4, 16))
[1] "Internal Error: requested buff size 20 greater than INT_MAX + 1."

But both in code and in browse view, this is what's actually there:

unitizer_sect('wrap', {
  invisible(fansi:::set_int_max(15))
  string <- '0123456789'
  strwrap_ctl(string, 16)
  strwrap2_ctl(string, 16, pad.end=' ')
  tce(strwrap2_ctl(string, 17, pad.end=' '))
  strwrap_ctl(string, 16, prefix='-----')
  tce(strwrap_ctl(string, 16, prefix='------'))
  strwrap_ctl(string, 16, indent=5)
  tce(strwrap_ctl(string, 16, indent=6))
  strwrap_ctl(string, 16, indent=2, prefix='---')
  tce(strwrap_ctl(string, 16, indent=3, prefix='---'))

  string2 <- '012345678901234'
  string3 <- '0123456789012345'
  strwrap_ctl(string2, 16)
  tce(strwrap_ctl(string3, 16))

  string4 <- '\033[31m0123456789'
  tce(strwrap_ctl(string4, 16))

  ## Overflow when wrap adds a closing tag
  invisible(fansi:::set_int_max(12))
  tce(strwrap_ctl("hello\033[31m a", 5))
})

Basically, it should be the string4 assignment shown, not string2.

brodieG commented 2 years ago

I was unable to reproduce this starting with a fresh file with just the above unitizer_sect in it.

brodieG commented 2 years ago

Tried again, still can't reproduce. Even tried to leave the test in question unaccepted to drop straight to it the second time around, and everything appeared to work fine.