Running ‘run.R’ [20s/22s]
Running the tests in ‘tests/run.R’ failed.
Complete output:
  > # to avoid variability on terminals with different capabilities
  > # plus generally random options being set
  > 
  > if(getRversion() < "3.2.2") {
  +   warning("Cannot run tests with R version less than 3.2.2.")
  + } else if(!suppressWarnings(require('fansi'))) {
  +   # this is to avoid accidentally running tests under valgrind without fansi
  +   # installed... (no, we've never done this...)
  +   warning("Cannot run tests without package `fansi`")
  + } else if(!suppressWarnings(require('unitizer'))) {
  +   warning("Cannot run tests without package `unitizer`")
  + } else {
  +   old.opt <- options(
  +     fansi.tabs.as.spaces=FALSE,
  +     fansi.tab.stops=8L,
  +     fansi.warn=TRUE,
  +     fansi.term.cap=c('bright', '256')
  +     # warnPartialMatchArgs = TRUE,
  +     # warnPartialMatchAttr = TRUE,
  +     # warnPartialMatchDollar = TRUE
  +   )
  +   on.exit(old.opt)
  +   unitize_dir(
  +     'unitizer',
  +     pattern="has|misc|nchar|overflow|strip|strsplit|substr|tabs|tohtml|wrap",
  +     state='recommended'
  +   )
  +   # we skip utf8 tests on solaris due to the problems with deparse (and maybe
  +   # others, don't have a solaris system handy for testing)
  + 
  +   if(!grepl("solaris|sun", Sys.info()[['sysname']], ignore.case=TRUE)) {
  +     unitize('unitizer/utf8.R')
  +   }
  + }
  Loading required package: fansi
  Loading required package: unitizer
  State tracking is disabled by default to comply with CRAN policies. Add `options(unitizer.state='suggested')` to your 'Rprofile' file to enable, or `options(unitizer.state='off')` to quash this message without enabling.  Prior to enabling, be sure to read `?unitizerState`,in particular the 'CRAN non-compliance' section.
  
  
                                                                                  
  Preloads...
                                                                                  
  Loading unitizer data...
                                                                                  
  Parsing tests...
                                                                                  
  Parsing unitizer/has.R
                                                                                  
  Parsing unitizer/misc.R
                                                                                  
  Parsing unitizer/nchar.R
                                                                                  
  Parsing unitizer/overflow.R
                                                                                  
  Parsing unitizer/strip.R
                                                                                  
  Parsing unitizer/strsplit.R
                                                                                  
  Parsing unitizer/substr.R
                                                                                  
  Parsing unitizer/tabs.R
                                                                                  
  Parsing unitizer/tohtml.R
                                                                                  
  Parsing unitizer/wrap.R
                                                                                  
  
                                                                                  
   1/10 has.R: 
                                                                                  
   1/10 has.R: library(fansi)
                                                                                  
   1/10 has.R: has_ctl(paste0(red, "hello", end))
                                                                                  
   1/10 has.R: has_ctl(paste0("hello", end))
                                                                                  
   1/10 has.R: has_ctl(paste0("hello"))
                                                                                  
   1/10 has.R: in.middle <- c("world", paste0("hello", red), "wow")
                                                                                  
   1/10 has.R: in.end <- c("world", "wow", paste0("hello", red))
                                                                                  
   1/10 has.R: in.start <- c(paste0("hello", red), "wow", "world")
                                                                                  
   1/10 has.R: has_ctl(in.middle)
                                                                                  
   1/10 has.R: has_ctl(in.end)
                                                                                  
   1/10 has.R: has_ctl(in.start)
                                                                                  
   1/10 has.R: has_ctl(c(in.start, NA))
                                                                                  
   1/10 has.R: has_ctl("hello\nworld")
                                                                                  
   1/10 has.R: has_sgr("hello\nworld")
                                                                                  
   1/10 has.R: has_sgr(in.end)
                                                                                  
   1/10 has.R: has_ctl("hello\033p world")
                                                                                  
   1/10 has.R: tryCatch(has_ctl("hello\033[31#0mworld"), warning = conditionMessag
                                                                                  
   1/10 has.R: suppressWarnings(has_ctl("hello\033[31#0mworld"))
                                                                                  
   1/10 has.R: has_ctl("hello world", ctl = c("sgr", "sgr"))
                                                                                  
   1/10 has.R: has_ctl("hello\033[31mworld", ctl = c("sgr"))
                                                                                  
   1/10 has.R: has_ctl("hello\033[31mworld", ctl = c("csi"))
                                                                                  
   1/10 has.R: has_ctl("hello\033[31!mworld", ctl = c("csi"))
                                                                                  
   1/10 has.R: has_ctl("hello\033[31lworld", ctl = c("csi"))
                                                                                  
   1/10 has.R: has_ctl("hello\nworld", ctl = c("all", "nl"))
                                                                                  
   1/10 has.R: has_ctl("hello\nworld", ctl = c("all", "c0"))
                                                                                  
   1/10 has.R: has_ctl("hello\tworld", ctl = c("all", "c0"))
                                                                                  
   1/10 has.R: has_ctl("hello\tworld", ctl = c("c0"))
                                                                                  
   1/10 has.R: has_ctl("hello\033pworld", ctl = c("esc"))
                                                                                  
   1/10 has.R: has_ctl("hello\033pworld", ctl = c("all", "esc"))
                                                                                  
   1/10 has.R: has_ctl("hello world", warn = NULL)
                                                                                  
   1/10 has.R: has_ctl("hello world", ctl = 1:3)
                                                                                  
   1/10 has.R: has_ctl("hello world", ctl = "bananas")
                                                                                  
   1/10 has.R: has_ctl("hello world", ctl = NA_character_)
                                                                                  
   1/10 has.R: has_ctl(c("\033[31mhello", "wo\nrld"), ctl = character())
                                                                                  
   1/10 has.R: has_ctl("hello world", which = "sgr")
                                                                                  
  
                                                                                  
   2/10 misc.R: 
                                                                                  
   2/10 misc.R: library(unitizer)
                                                                                  
   2/10 misc.R: library(fansi)
                                                                                  
   2/10 misc.R: tct <- term_cap_test()
                                                                                  
   2/10 misc.R: tct
                                                                                  
   2/10 misc.R: fansi_lines(LETTERS, step = 6)
                                                                                  
   2/10 misc.R: ints <- c(-100L, -9999L, -1L, 0L, 1L, 9L, 10L, 99L, 100L, 101L, 
                                                                                  
   2/10 misc.R: cbind(ints, fansi:::digits_in_int(ints))
                                                                                  
   2/10 misc.R: fansi:::add_int(1, 1)
                                                                                  
   2/10 misc.R: fansi:::add_int(2^31 - 1, 1)
                                                                                  
   2/10 misc.R: fansi:::add_int(2^31 - 1, 0)
                                                                                  
   2/10 misc.R: fansi:::add_int(-2^31 + 1, 0)
                                                                                  
   2/10 misc.R: fansi:::add_int(-2^31 + 1, -1)
                                                                                  
   2/10 misc.R: string.0 <- c("\033[41mhello world\033[m", "foo\033[22>m", "\033[9
                                                                                  
   2/10 misc.R: unhandled_ctl(string.0)
                                                                                  
   2/10 misc.R: string.1 <- c("foo\033[22>mhello\033[9999m", "a\033[31k", "hello\0
                                                                                  
   2/10 misc.R: unhandled_ctl(string.1)
                                                                                  
   2/10 misc.R: unhandled_ctl("hello\033\033\033[45p wor\ald")
                                                                                  
   2/10 misc.R: unhandled_ctl("\033[38;5;220mworld\033[m", "bright")
                                                                                  
   2/10 misc.R: unhandled_ctl("\033[38;2;10;20;30mworld\033[m", "bright")
                                                                                  
   2/10 misc.R: unhandled_ctl("\033[38;2;10;20;30mworld\033[m", "bri")
                                                                                  
   2/10 misc.R: unhandled_ctl("\033[38;2;10;20;30mworld\033[m", NULL)
                                                                                  
   2/10 misc.R: strtrim_ctl(" hello world", 7)
                                                                                  
   2/10 misc.R: strtrim_ctl("\033[42m hello world\033[m", 7)
                                                                                  
   2/10 misc.R: strtrim_ctl(" hello\nworld", 7)
                                                                                  
   2/10 misc.R: strtrim_ctl("\033[42m hello\nworld\033[m", 7)
                                                                                  
   2/10 misc.R: strtrim_ctl("\nhello\nworld", 7)
                                                                                  
   2/10 misc.R: strtrim_ctl("\033[42m\nhello\nworld\033[m", 7)
                                                                                  
   2/10 misc.R: strtrim_ctl("\thello\rworld foobar", 12)
                                                                                  
   2/10 misc.R: strtrim_ctl("\033[42m\thello\rworld\033[m foobar", 12)
                                                                                  
   2/10 misc.R: strtrim2_ctl("\033[42m\thello world\033[m foobar", 12, tabs.as.spa
                                                                                  
   2/10 misc.R: strtrim_sgr("\033[42m\the\allo world\033[m foobar", 12, warn = FAL
                                                                                  
   2/10 misc.R: strtrim2_sgr("\033[42m\the\allo world\033[m foobar", 12, tabs.as.s
                                                                                  
   2/10 misc.R: hello2.0 <- "\033[42m\thello world\033[m foobar"
                                                                                  
   2/10 misc.R: strtrim_ctl(1:3, width = 10)
                                                                                  
   2/10 misc.R: strtrim_ctl(hello2.0, width = "35")
                                                                                  
   2/10 misc.R: strtrim_ctl(hello2.0, width = NA_integer_)
                                                                                  
   2/10 misc.R: strtrim_ctl(hello2.0, width = 10, warn = NULL)
                                                                                  
   2/10 misc.R: strtrim_ctl(hello2.0, width = 10, ctl = 0)
                                                                                  
   2/10 misc.R: strtrim_ctl(hello2.0, width = 10, ctl = "bananas")
                                                                                  
   2/10 misc.R: strtrim2_ctl(1:3, width = 10)
                                                                                  
   2/10 misc.R: strtrim2_ctl(hello2.0, width = "35")
                                                                                  
   2/10 misc.R: strtrim2_ctl(hello2.0, width = NA_integer_)
                                                                                  
   2/10 misc.R: strtrim2_ctl(hello2.0, width = 10, warn = NULL)
                                                                                  
   2/10 misc.R: strtrim2_ctl(hello2.0, width = 10, tabs.as.spaces = NA)
                                                                                  
   2/10 misc.R: strtrim2_ctl(hello2.0, width = 10, tabs.as.spaces = 1:3)
                                                                                  
   2/10 misc.R: strtrim2_ctl(hello2.0, width = 10, tab.stops = -(1:3))
                                                                                  
   2/10 misc.R: strtrim2_ctl(hello2.0, width = 10, tab.stops = 0)
                                                                                  
   2/10 misc.R: strtrim2_ctl(hello2.0, width = 10, ctl = 0)
                                                                                  
   2/10 misc.R: strtrim2_ctl(hello2.0, width = 10, ctl = "bananas")
                                                                                  
   2/10 misc.R: fansi:::cleave(1:10)
                                                                                  
   2/10 misc.R: fansi:::cleave(1:9)
                                                                                  
   2/10 misc.R: fansi:::cleave(1:10 + 0.1)
                                                                                  
   2/10 misc.R: set.seed(42)
                                                                                  
   2/10 misc.R: jumbled <- as.character(rep(1:10, 10))[sample(1:100)]
                                                                                  
   2/10 misc.R: sorted <- fansi:::sort_chr(jumbled)
                                                                                  
   2/10 misc.R: which(as.logical(diff(as.numeric(sorted))))
                                                                                  
   2/10 misc.R: x <- y <- "He\x9f"
                                                                                  
   2/10 misc.R: Encoding(x) <- "latin1"
                                                                                  
   2/10 misc.R: fansi:::check_enc(x, 1)
                                                                                  
   2/10 misc.R: Encoding(y) <- "bytes"
                                                                                  
   2/10 misc.R: fansi:::check_enc(y, 1)
                                                                                  
   2/10 misc.R: fansi:::check_enc("hello", 1)
                                                                                  
   2/10 misc.R: fansi:::ctl_as_int(c(1, 2, 3, 4, 5))
                                                                                  
   2/10 misc.R: fansi:::ctl_as_int(c(2, 3, 4, 5))
                                                                                  
   2/10 misc.R: fansi:::ctl_as_int(c(1, 2, 3, 7))
                                                                                  
   2/10 misc.R: fansi:::ctl_as_int(c(2, 3, 7))
                                                                                  
   2/10 misc.R: html_esc(character())
                                                                                  
   2/10 misc.R: html_esc(1:10)
                                                                                  
   2/10 misc.R: html_esc(NA_character_)
                                                                                  
   2/10 misc.R: html_esc("<he&llo>")
                                                                                  
   2/10 misc.R: html_esc("ow&wo")
                                                                                  
   2/10 misc.R: html_esc(c("hello", "wor<ld>s", NA, ""))
                                                                                  
   2/10 misc.R: html_esc("<<<<")
                                                                                  
   2/10 misc.R: txt <- c("day > night", "hello world")
                                                                                  
   2/10 misc.R: html_code_block(character())
                                                                                  
   2/10 misc.R: html_code_block(txt)
                                                                                  
   2/10 misc.R: html_code_block(1:10)
                                                                                  
   2/10 misc.R: html_code_block(txt, class = c("not-fansi", "plain"))
                                                                                  
   2/10 misc.R: html_code_block(txt, class = NULL)
                                                                                  
   2/10 misc.R: h.1 <- list(set = function(...) cat("Set hooks: ", names(list(...)
                                                                                  
   2/10 misc.R: h.2 <- list(set = function(...) cat("Set hooks: ", names(list(...)
                                                                                  
   2/10 misc.R: h.3 <- list(set = function(...) cat("Set hooks: ", names(list(...)
                                                                                  
   2/10 misc.R: h.4 <- list(set = function(...) stop("error in set"), get = functi
                                                                                  
   2/10 misc.R: set_knit_hooks(list(1, 2))
                                                                                  
   2/10 misc.R: set_knit_hooks(list(function() NULL, function() NULL))
                                                                                  
   2/10 misc.R: res1 <- set_knit_hooks(h.1, .test = TRUE)
                                                                                  
   2/10 misc.R: res1[["new.hooks"]][["output"]]("hello")
                                                                                  
   2/10 misc.R: res1[["new.hooks"]][["output"]]("hello\033[31m world")
                                                                                  
   2/10 misc.R: res1a <- set_knit_hooks(h.1, split.nl = TRUE, .test = TRUE)
                                                                                  
   2/10 misc.R: res1a[["new.hooks"]][["output"]]("hello\033[31m wo\nrld")
                                                                                  
   2/10 misc.R: p.f.2 <- function(x, y) NULL
                                                                                  
   2/10 misc.R: p.f.3 <- function(x, class) sprintf("new proc fun, '%s'", class)
                                                                                  
   2/10 misc.R: p.f.4 <- function(x, class) stop("new proc fun")
                                                                                  
   2/10 misc.R: set_knit_hooks(h.1, split.nl = "banana")
                                                                                  
   2/10 misc.R: set_knit_hooks(h.1, proc.fun = p.f.2)
                                                                                  
   2/10 misc.R: set_knit_hooks(h.1, which = "hello")
                                                                                  
   2/10 misc.R: set_knit_hooks(h.1, which = NULL)
                                                                                  
   2/10 misc.R: res2 <- set_knit_hooks(h.1, which = c("output", "message"), class 
                                                                                  
   2/10 misc.R: res2[["new.hooks"]][["message"]]("hello")
                                                                                  
   2/10 misc.R: res2[["new.hooks"]][["message"]]("hello\033[31m world")
                                                                                  
   2/10 misc.R: res2[["new.hooks"]][["output"]]("hello\033[31m world")
                                                                                  
   2/10 misc.R: res3 <- set_knit_hooks(h.1, which = c("message", "warning"), 
                                                                                  
   2/10 misc.R: res3[["new.hooks"]][["warning"]]("hello")
                                                                                  
   2/10 misc.R: res3[["new.hooks"]][["warning"]]("hello\033[31mworld")
                                                                                  
   2/10 misc.R: set_knit_hooks(h.2)
                                                                                  
   2/10 misc.R: set_knit_hooks(h.3)
                                                                                  
   2/10 misc.R: set_knit_hooks(h.4)
                                                                                  
   2/10 misc.R: set_knit_hooks(h.1, style = NULL)
                                                                                  
   2/10 misc.R: set_knit_hooks(h.1, class = 1:10)
                                                                                  
   2/10 misc.R: set_knit_hooks(h.1, class = letters)
                                                                                  
   2/10 misc.R: set_knit_hooks(h.1, which = c("output", "message", "output"))
                                                                                  
   2/10 misc.R: fansi_lines(1:3)
                                                                                  
   2/10 misc.R: fansi_lines(1:3, step = "hello")
                                                                                  
  
                                                                                  
   3/10 nchar.R: 
                                                                                  
   3/10 nchar.R: library(fansi)
                                                                                  
   3/10 nchar.R: nchar_ctl(c("hello", "world"))
                                                                                  
   3/10 nchar.R: nchar_ctl(c("hello", "world"), type = "width")
                                                                                  
   3/10 nchar.R: nchar_ctl(c("hello", "world"), type = "wi")
                                                                                  
   3/10 nchar.R: na.world <- c("hello", NA, "world")
                                                                                  
   3/10 nchar.R: nchar_ctl(na.world)
                                                                                  
   3/10 nchar.R: nchar_ctl(na.world, keepNA = FALSE)
                                                                                  
   3/10 nchar.R: nchar_ctl(na.world, keepNA = NA, type = "width")
                                                                                  
   3/10 nchar.R: nchar_ctl(na.world, keepNA = TRUE, type = "width")
                                                                                  
   3/10 nchar.R: nzchar_ctl(na.world)
                                                                                  
   3/10 nchar.R: nzchar_ctl(na.world, keepNA = NA)
                                                                                  
   3/10 nchar.R: nzchar_ctl(na.world, keepNA = TRUE)
                                                                                  
   3/10 nchar.R: esc.2 <- "\n\r\033P\033[31m\a"
                                                                                  
   3/10 nchar.R: nchar_ctl(esc.2)
                                                                                  
   3/10 nchar.R: nchar_ctl(esc.2, warn = FALSE)
                                                                                  
   3/10 nchar.R: nzchar_ctl(esc.2)
                                                                                  
   3/10 nchar.R: nzchar_ctl(esc.2, warn = FALSE)
                                                                                  
   3/10 nchar.R: nchar_ctl("\033[31#mworld", ctl = "sgr")
                                                                                  
   3/10 nchar.R: nchar_ctl("\033[31#mworld", ctl = "csi")
                                                                                  
   3/10 nchar.R: esc.3 <- "\n\t\033[31m\033[41!m\033p"
                                                                                  
   3/10 nchar.R: nzchar_ctl(esc.3, warn = FALSE)
                                                                                  
   3/10 nchar.R: nzchar_ctl(sprintf("%sa", esc.3), warn = FALSE)
                                                                                  
   3/10 nchar.R: nzchar_ctl(esc.3, ctl = c("sgr", "csi", "esc"), warn = FALSE)
                                                                                  
   3/10 nchar.R: nzchar_ctl(esc.3, ctl = c("c0", "nl"), warn = FALSE)
                                                                                  
   3/10 nchar.R: nzchar_ctl("\n\t\n", ctl = c("nl"), warn = FALSE)
                                                                                  
   3/10 nchar.R: nzchar_ctl("\t\n", ctl = c("nl"), warn = FALSE)
                                                                                  
   3/10 nchar.R: nchar_ctl(9:10, warn = 1:3)
                                                                                  
   3/10 nchar.R: nchar_ctl("hello\033[31m world", allowNA = 1:3)
                                                                                  
   3/10 nchar.R: nchar_ctl("hello\033[31m world", keepNA = 1:3)
                                                                                  
   3/10 nchar.R: nchar_ctl("hello\033[31m world", strip = 1:3)
                                                                                  
   3/10 nchar.R: nchar_ctl("hello\033[31m world", ctl = "bananas")
                                                                                  
   3/10 nchar.R: nchar_ctl("hello\033[31m world", type = NA_character_)
                                                                                  
   3/10 nchar.R: nchar_ctl("hello\033[31m world", type = 1)
                                                                                  
   3/10 nchar.R: nchar_ctl("hello\033[31m world", type = "bananas")
                                                                                  
   3/10 nchar.R: nzchar_ctl(9:10, warn = 1:3)
                                                                                  
   3/10 nchar.R: nzchar_ctl("hello\033[31m world", keepNA = 1:3)
                                                                                  
   3/10 nchar.R: nzchar_ctl("hello\033[31m world", ctl = 1)
                                                                                  
   3/10 nchar.R: nzchar_ctl("hello\033[31m world", ctl = "bananas")
                                                                                  
  
                                                                                  
   4/10 overflow.R: 
                                                                                  
   4/10 overflow.R: library(fansi)
                                                                                  
   4/10 overflow.R: old_max <- fansi:::set_int_max(15)
                                                                                  
   4/10 overflow.R: tabs_as_spaces("\t1234567")
                                                                                  
   4/10 overflow.R: tryCatch(tabs_as_spaces("\t12345678"), error = conditionMessag
                                                                                  
   4/10 overflow.R: invisible(fansi:::set_int_max(12))
                                                                                  
   4/10 overflow.R: tabs_as_spaces(c("\t", "\t123"))
                                                                                  
   4/10 overflow.R: invisible(fansi:::set_int_max(15))
                                                                                  
   4/10 overflow.R: string <- "0123456789"
                                                                                  
   4/10 overflow.R: strwrap_ctl(string, 16)
                                                                                  
   4/10 overflow.R: strwrap2_ctl(string, 16, pad.end = " ")
                                                                                  
   4/10 overflow.R: tce(strwrap2_ctl(string, 17, pad.end = " "))
                                                                                  
   4/10 overflow.R: strwrap_ctl(string, 16, prefix = "-----")
                                                                                  
   4/10 overflow.R: tce(strwrap_ctl(string, 16, prefix = "------"))
                                                                                  
   4/10 overflow.R: strwrap_ctl(string, 16, indent = 5)
                                                                                  
   4/10 overflow.R: tce(strwrap_ctl(string, 16, indent = 6))
                                                                                  
   4/10 overflow.R: strwrap_ctl(string, 16, indent = 2, prefix = "---")
                                                                                  
   4/10 overflow.R: tce(strwrap_ctl(string, 16, indent = 3, prefix = "---"))
                                                                                  
   4/10 overflow.R: string2 <- "012345678901234"
                                                                                  
   4/10 overflow.R: string3 <- "0123456789012345"
                                                                                  
   4/10 overflow.R: strwrap_ctl(string2, 16)
                                                                                  
   4/10 overflow.R: tce(strwrap_ctl(string3, 16))
                                                                                  
   4/10 overflow.R: string4 <- "\033[31m0123456789"
                                                                                  
   4/10 overflow.R: tce(strwrap_ctl(string4, 16))
                                                                                  
   4/10 overflow.R: invisible(fansi:::set_int_max(37))
                                                                                  
   4/10 overflow.R: sgr_to_html("\033[31m")
                                                                                  
   4/10 overflow.R: tce(sgr_to_html("\033[31ma"))
                                                                                  
   4/10 overflow.R: tce(sgr_to_html("\033[31m\033[42mhello"))
                                                                                  
   4/10 overflow.R: invisible(fansi:::set_int_max(10))
                                                                                  
   4/10 overflow.R: string <- paste0(rep("\a", 10), collapse = "")
                                                                                  
   4/10 overflow.R: unhandled_ctl(string)
                                                                                  
   4/10 overflow.R: tcw(unhandled_ctl(c("\a", string)))
                                                                                  
   4/10 overflow.R: suppressWarnings(unhandled_ctl(c("\a", string)))
                                                                                  
   4/10 overflow.R: new_max <- fansi:::set_int_max(old_max)
                                                                                  
  
                                                                                  
   5/10 strip.R: 
                                                                                  
   5/10 strip.R: library(fansi)
                                                                                  
   5/10 strip.R: strip_ctl(sprintf("hello %sworld%s", red, end))
                                                                                  
   5/10 strip.R: strip_ctl(sprintf("he%sllo %sworld", red, end))
                                                                                  
   5/10 strip.R: strip_ctl(sprintf("%shello %sworld%s", grn.bg, red, end))
                                                                                  
   5/10 strip.R: strip_ctl(sprintf("%s%shello %sworld%s", grn.bg, inv, red, end))
                                                                                  
   5/10 strip.R: string <- paste("string", format(1:10))
                                                                                  
   5/10 strip.R: string[c(2, 4, 6)] <- paste0(red, string[c(2, 4, 6)], end)
                                                                                  
   5/10 strip.R: strip_ctl(string)
                                                                                  
   5/10 strip.R: strip_sgr(string)
                                                                                  
   5/10 strip.R: strip_sgr(1:3)
                                                                                  
   5/10 strip.R: strip_ctl("hello\033")
                                                                                  
   5/10 strip.R: strip_ctl("hello\033[")
                                                                                  
   5/10 strip.R: strip_ctl("hello\033[31##3m illegal")
                                                                                  
   5/10 strip.R: strip_ctl("hello\033[31##m legal")
                                                                                  
   5/10 strip.R: strip_ctl(1:3)
                                                                                  
   5/10 strip.R: fansi:::process("hello     world")
                                                                                  
   5/10 strip.R: fansi:::process("hello.    world")
                                                                                  
   5/10 strip.R: fansi:::process(c("hello     world", "hello.    world"))
                                                                                  
   5/10 strip.R: fansi:::process("hello.   world?   moon!   wow.")
                                                                                  
   5/10 strip.R: fansi:::process("  hello")
                                                                                  
   5/10 strip.R: fansi:::process("  hello\n  world")
                                                                                  
   5/10 strip.R: fansi:::process("  hello  \n  world")
                                                                                  
   5/10 strip.R: fansi:::process("  hello world\n  ")
                                                                                  
   5/10 strip.R: fansi:::process("hello.   ")
                                                                                  
   5/10 strip.R: fansi:::process("hello!  ")
                                                                                  
   5/10 strip.R: fansi:::process("hello? ")
                                                                                  
   5/10 strip.R: fansi:::process("hello? ")
                                                                                  
   5/10 strip.R: fansi:::process(" \t hello")
                                                                                  
   5/10 strip.R: fansi:::process(" \t\a\r hello")
                                                                                  
   5/10 strip.R: fansi:::process("hello.  \r world.")
                                                                                  
   5/10 strip.R: fansi:::process("hello.  \033[31m world.\033[0m")
                                                                                  
   5/10 strip.R: str1 <- c("hello ", " world")
                                                                                  
   5/10 strip.R: fansi:::process(str1)
                                                                                  
   5/10 strip.R: str1
                                                                                  
   5/10 strip.R: fansi:::process("hello.\n\nworld")
                                                                                  
   5/10 strip.R: fansi:::process("hello.\n\n\nworld")
                                                                                  
   5/10 strip.R: fansi:::process("hello.\n\n\n\nworld")
                                                                                  
   5/10 strip.R: fansi:::process("hello.\n  \nworld")
                                                                                  
   5/10 strip.R: fansi:::process("hello.\n\t\nworld")
                                                                                  
   5/10 strip.R: fansi:::process("hello.\n\t\n\tworld")
                                                                                  
   5/10 strip.R: fansi:::process("hello.\n \t \n \t world")
                                                                                  
   5/10 strip.R: fansi:::process("hello.\n\nworld\n\n")
                                                                                  
   5/10 strip.R: fansi:::process("hello.\n\nworld\n\n  ")
                                                                                  
   5/10 strip.R: fansi:::process("\n\nhello.\n\t\n\tworld\n\t\n woohoo\n ")
                                                                                  
   5/10 strip.R: fansi:::process("\n \t\nhello.\n\t\n\tworld\n\t\n woohoo\n ")
                                                                                  
   5/10 strip.R: string.0 <- "hello\033k\033[45p world\n\033[31mgoodbye\a moon"
                                                                                  
   5/10 strip.R: strip_ctl(string.0)
                                                                                  
   5/10 strip.R: strip_ctl(string.0, "sgr")
                                                                                  
   5/10 strip.R: strip_ctl(string.0, c("nl", "c0", "sgr", "csi", "esc"))
                                                                                  
   5/10 strip.R: strip_ctl(string.0, "all")
                                                                                  
   5/10 strip.R: strip_ctl(string.0, c("c0", "esc"))
                                                                                  
   5/10 strip.R: strip_ctl(string.0, c("nl"))
                                                                                  
   5/10 strip.R: strip_ctl(string.0, character())
                                                                                  
   5/10 strip.R: strip_ctl(string.0, c("all", "c0", "esc"))
                                                                                  
   5/10 strip.R: strip_ctl(string.0, c("all", "sgr"))
                                                                                  
   5/10 strip.R: string.1 <- "hello\033\033[45p world\n\033[31#3mgoodbye\a moon"
                                                                                  
   5/10 strip.R: strip_ctl(string.1, c("nl", "sgr", "esc"))
                                                                                  
   5/10 strip.R: strip_ctl(string.1, c("csi"))
                                                                                  
   5/10 strip.R: strip_ctl(string.1, "all")
                                                                                  
   5/10 strip.R: strip_ctl(string.1, c("c0", "nl"))
                                                                                  
   5/10 strip.R: strip_ctl(string.1, c("all", "sgr"))
                                                                                  
   5/10 strip.R: strip_sgr(string.1)
                                                                                  
   5/10 strip.R: strip_ctl(c(string.0, string.1, "hello"), warn = FALSE)
                                                                                  
   5/10 strip.R: string.2 <- "\033k\033[45p\a\n\033[31mgoodbye moon"
                                                                                  
   5/10 strip.R: strip_ctl(string.2)
                                                                                  
   5/10 strip.R: strip_ctl(string.2, "sgr")
                                                                                  
   5/10 strip.R: string.3 <- "hello world\033k\033[45p\a\n\033[31m"
                                                                                  
   5/10 strip.R: strip_ctl(string.3)
                                                                                  
   5/10 strip.R: strip_ctl(string.3, "sgr")
                                                                                  
   5/10 strip.R: strip_ctl("hello\033[41mworld", warn = 1:3)
                                                                                  
   5/10 strip.R: strip_ctl("hello\033[41mworld", ctl = 1:3)
                                                                                  
   5/10 strip.R: strip_ctl("hello\033[41mworld", ctl = "bananas")
                                                                                  
   5/10 strip.R: strip_ctl("hello\033[41mworld", strip = "sgr")
                                                                                  
   5/10 strip.R: strip_sgr("hello\033[41mworld", warn = 1:3)
                                                                                  
  
                                                                                  
   6/10 strsplit.R: 
                                                                                  
   6/10 strsplit.R: library(fansi)
                                                                                  
   6/10 strsplit.R: str.1 <- "hello\033[31m world"
                                                                                  
   6/10 strsplit.R: str.2 <- "\033[42m hello\033[m world, Goodbye Moon"
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.1, " ")
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.1, "hello")
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.2, ", ")
                                                                                  
   6/10 strsplit.R: strsplit_ctl(c(str.1, "hello world", str.2), "hello")
                                                                                  
   6/10 strsplit.R: strsplit_ctl("hello\033[31m world", "")
                                                                                  
   6/10 strsplit.R: strsplit_ctl("hello\033[31m world", "[", fixed = TRUE)
                                                                                  
   6/10 strsplit.R: strsplit_ctl("hello\033[31m world", NA_character_)
                                                                                  
   6/10 strsplit.R: strsplit_ctl("hello\033[31m world", character())
                                                                                  
   6/10 strsplit.R: strsplit_ctl("hello\033[31m world", letters)
                                                                                  
   6/10 strsplit.R: splits <- c("h", "e", "o", "llo", "x", "hello")
                                                                                  
   6/10 strsplit.R: str.spl1 <- strsplit_ctl(rep("hello", 6), splits)
                                                                                  
   6/10 strsplit.R: str.spl2 <- strsplit(rep("hello", 6), splits)
                                                                                  
   6/10 strsplit.R: identical(str.spl1, str.spl2)
                                                                                  
   6/10 strsplit.R: str.spl3 <- strsplit_ctl(rep("\033[31mhello\033[39m", 6), spli
                                                                                  
   6/10 strsplit.R: str.spl3
                                                                                  
   6/10 strsplit.R: identical(lapply(str.spl3, strip_ctl), str.spl2)
                                                                                  
   6/10 strsplit.R: strsplit_ctl("", " ")
                                                                                  
   6/10 strsplit.R: strsplit_ctl("", "")
                                                                                  
   6/10 strsplit.R: strsplit_ctl(c("\033[31mab\033[0m", ""), "")
                                                                                  
   6/10 strsplit.R: strsplit_ctl("hello", NULL)
                                                                                  
   6/10 strsplit.R: str.sp14 <- c("\033[31mhello\nworld", "\ngoodbye\nmoon")
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.sp14, "\n")
                                                                                  
   6/10 strsplit.R: strsplit_sgr(str.sp14, "\n")
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.sp14, "\n", ctl = c("all", "nl"))
                                                                                  
   6/10 strsplit.R: str.bytes <- "\xde"
                                                                                  
   6/10 strsplit.R: Encoding(str.bytes) <- "bytes"
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.bytes, "")
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.2, NA)
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.2, "", warn = NULL)
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.2, "", fixed = NA_integer_)
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.2, "", perl = NA_integer_)
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.2, "", useBytes = NA_integer_)
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.2, "", term.cap = 1:3)
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.2, "", term.cap = "bananas")
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.2, "", ctl = 1:3)
                                                                                  
   6/10 strsplit.R: strsplit_ctl(str.2, "", ctl = "bananas")
                                                                                  
   6/10 strsplit.R: strsplit_ctl("hello\nworld", "\n")
                                                                                  
   6/10 strsplit.R: strsplit_sgr("hello\033[31mworld", "\033[31m", fixed = TRUE)
                                                                                  
   6/10 strsplit.R: strsplit_ctl("a\nb", "\n", ctl = c("all", "nl"))
                                                                                  
   6/10 strsplit.R: strsplit_sgr("hello\nworld", "\n")
                                                                                  
  
                                                                                  
   7/10 substr.R: 
                                                                                  
   7/10 substr.R: library(fansi)
                                                                                  
   7/10 substr.R: str01 <- sprintf("hello %sworld%s how", red, inv)
                                                                                  
   7/10 substr.R: substr_ctl(str01, 1, 7)
                                                                                  
   7/10 substr.R: substr_ctl(str01, 7, 11)
                                                                                  
   7/10 substr.R: substr_ctl(str01, 8, 10)
                                                                                  
   7/10 substr.R: substr_ctl(str01, 8, 14)
                                                                                  
   7/10 substr.R: str02 <- sprintf("%shello world %sit's a %scrazy world%s out the
                                                                                  
   7/10 substr.R: term.cap <- c("bright", "256", "truecolor")
                                                                                  
   7/10 substr.R: substr_ctl(str02, 1, 7)
                                                                                  
   7/10 substr.R: substr_ctl(str02, 10, 20)
                                                                                  
   7/10 substr.R: substr_ctl(str02, 15, 40, term.cap = term.cap)
                                                                                  
   7/10 substr.R: substr_ctl(str02, 35, 60, term.cap = term.cap)
                                                                                  
   7/10 substr.R: str03 <- sprintf("hello %sworld", rgb.und)
                                                                                  
   7/10 substr.R: substr_ctl(str03, 1, 12, term.cap = term.cap)
                                                                                  
   7/10 substr.R: str04 <- sprintf("hello%s%s world%s%s yowza", red, inv, grn.bg, 
                                                                                  
   7/10 substr.R: substr_ctl(str04, 5, 7, term.cap = term.cap)
                                                                                  
   7/10 substr.R: substr_ctl(str04, 5, 13, term.cap = term.cap)
                                                                                  
   7/10 substr.R: str.m.0 <- paste0("\033[44m", c("hello world", rep("goodbye \033
                                                                                  
   7/10 substr.R: substr_ctl(str.m.0, (1:4) * 2, (3:8) * 2)
                                                                                  
   7/10 substr.R: substr2_ctl("yo\tworld", 1, 8, tabs.as.spaces = TRUE)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 0, -1)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 0, 0)
                                                                                  
   7/10 substr.R: substr_ctl(rep("hello", 2), c(1, 0), c(1, 1))
                                                                                  
   7/10 substr.R: substr_ctl(character(), 1, 1)
                                                                                  
   7/10 substr.R: substr_ctl(list("hello", list("goodbye", "there")), 1, 2)
                                                                                  
   7/10 substr.R: substr_ctl(structure(list(list("goodbye", "there")), class = "fo
                                                                                  
   7/10 substr.R: str.0 <- "\033[31mred\033[m"
                                                                                  
   7/10 substr.R: str.1 <- "\033[31mred\033[42m"
                                                                                  
   7/10 substr.R: str.2 <- c(str.0, str.1)
                                                                                  
   7/10 substr.R: substr_ctl(str.2, 0, 0)
                                                                                  
   7/10 substr.R: substr_ctl(str.2, 1, 1)
                                                                                  
   7/10 substr.R: substr_ctl(str.2, 3, 3)
                                                                                  
   7/10 substr.R: substr_ctl(str.2, 4, 4)
                                                                                  
   7/10 substr.R: substr_ctl(str.2, 3, 4)
                                                                                  
   7/10 substr.R: substr_ctl(str.2, 3, 5)
                                                                                  
   7/10 substr.R: substr_ctl(str.2, -1, 2)
                                                                                  
   7/10 substr.R: substr_ctl(str.2, -2, -1)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 5, 5)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 6, 6)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 7, 6)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 6, 7)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 7, 5)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 0, 6)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 0, 5)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 1, 6)
                                                                                  
   7/10 substr.R: substr_ctl("hello", "1", 1)
                                                                                  
   7/10 substr.R: substr_ctl("hello", 1, "1")
                                                                                  
   7/10 substr.R: substr_ctl("hello", "a", "b")
                                                                                  
   7/10 substr.R: substr_ctl("hello", 1, NA_integer_)
                                                                                  
   7/10 substr.R: substr_ctl("hello", NA_integer_, 1)
                                                                                  
   7/10 substr.R: substr_ctl(rep("\033[31mhello\033[m", 3), c(3, 2, 1), c(3, 4, 
                                                                                  
   7/10 substr.R: str.3 <- structure("fu\033[42mba\033[0mr", class = "foo", at = "
                                                                                  
   7/10 substr.R: substr_ctl(str.3, 2, 3)
                                                                                  
   7/10 substr.R: substr_ctl(str.2, 2, 6, ctl = c("all", "sgr"))
                                                                                  
   7/10 substr.R: substr_ctl(str.2, 8, 10, ctl = c("all", "sgr"))
                                                                                  
   7/10 substr.R: tryCatch(substr_ctl("\033[38;6;31mworld\033[m", 2, 3), warning =
                                                                                  
   7/10 substr.R: suppressWarnings(substr_ctl("\033[38;6;31mworld\033[m", 2, 3))
                                                                                  
   7/10 substr.R: tryCatch(substr_ctl("\033[31mhello\033[38;5;256m world\033[m", 
                                                                                  
   7/10 substr.R: suppressWarnings(substr_ctl("\033[31mhello\033[38;5;256m world\0
                                                                                  
   7/10 substr.R: substr_ctl("\033[20mworld\033[m", 2, 3)
                                                                                  
   7/10 substr.R: substr_ctl("\033[21mworld\033[m", 2, 3)
                                                                                  
   7/10 substr.R: substr_ctl(rep("\033[26mhello \033[50mworld\033[m", 2), c(2, 
                                                                                  
   7/10 substr.R: substr_ctl(rep("\033[61mwor\033[65mld\033[m", 2), c(2, 4), c(3, 
                                                                                  
   7/10 substr.R: tryCatch(substr_ctl("\033[56mworld\033[m", 2, 3), warning = cond
                                                                                  
   7/10 substr.R: suppressWarnings(substr_ctl("\033[56mworld\033[m", 2, 3))
                                                                                  
   7/10 substr.R: tryCatch(substr_ctl("\033[66mworld\033[m", 2, 3), warning = cond
                                                                                  
   7/10 substr.R: tryCatch(substr_ctl("\033[200mworld\033[m", 2, 3), warning = con
                                                                                  
   7/10 substr.R: substr_ctl(rep("\033[91mwor\033[101mld\033[m", 2), c(2, 4), c(3,
                                                                                  
   7/10 substr.R: hello2.0 <- "\033[42m\thello world\033[m foobar"
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, warn = NULL)
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, tabs.as.spaces = 1)
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, tabs.as.spaces = NA)
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, tab.stops = -(1:3))
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, tab.stops = 0)
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, round = "bananas")
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, term.cap = 0)
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, term.cap = "bananas")
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, type = "bananas")
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, ctl = "bananas")
                                                                                  
   7/10 substr.R: substr2_ctl(hello2.0, 1, 2, ctl = 0)
                                                                                  
   7/10 substr.R: substr_sgr("\033[31;42mhello world", 2, 4)
                                                                                  
   7/10 substr.R: substr_sgr("\033[31m\033[42mhello world", 2, 4)
                                                                                  
   7/10 substr.R: tryCatch(substr_sgr("\033[31;42!mhello world", 2, 4), warning = 
                                                                                  
   7/10 substr.R: substr_sgr("\033[55;38l\033[31mhello world", 2, 4, warn = FALSE)
                                                                                  
   7/10 substr.R: substr_sgr("\033[31m\033[55;38lhello world", 2, 4, warn = FALSE)
                                                                                  
   7/10 substr.R: substr_sgr("hello \033[31m\033[55;38lworld", 7, 9, warn = FALSE)
                                                                                  
   7/10 substr.R: substr_ctl("\033[55;38l\033[31mhello world", 2, 4, warn = FALSE)
                                                                                  
   7/10 substr.R: substr_ctl("\033[31m\033[55;38lhello world", 2, 4, warn = FALSE)
                                                                                  
   7/10 substr.R: substr_ctl("hello \033[31m\033[55;38lworld", 7, 9, warn = FALSE)
                                                                                  
   7/10 substr.R: substr_ctl("hello\033[55;38l \033[31mworld", 4, 7, warn = FALSE)
                                                                                  
   7/10 substr.R: substr_sgr("ab\n\tcd\n", 3, 6, warn = FALSE)
                                                                                  
   7/10 substr.R: substr_sgr("ab\n\033[31m\tcd\n", 3, 6, warn = FALSE)
                                                                                  
   7/10 substr.R: substr_ctl("ab\n\033[31m\tcd\n", 3, 6, warn = FALSE, ctl = c("al
                                                                                  
   7/10 substr.R: substr_ctl("ab\n\033[31m\tcd\n", 3, 6, warn = FALSE, ctl = c("al
                                                                                  
  
                                                                                  
   8/10 tabs.R: 
                                                                                  
   8/10 tabs.R: library(unitizer)
                                                                                  
   8/10 tabs.R: library(fansi)
                                                                                  
   8/10 tabs.R: string <- "1\t12\t123\t1234\t12345678"
                                                                                  
   8/10 tabs.R: tabs_as_spaces(string)
                                                                                  
   8/10 tabs.R: tabs_as_spaces(string, c(2, 3, 4, 5, 8))
                                                                                  
   8/10 tabs.R: tabs_as_spaces(string, c(2, 8))
                                                                                  
   8/10 tabs.R: tabs_as_spaces(1:3)
                                                                                  
   8/10 tabs.R: string.n <- paste0("1\t12\t123\t1234\t12345678\n", "1\t12\t123\t12
                                                                                  
   8/10 tabs.R: tabs_as_spaces(string.n)
                                                                                  
   8/10 tabs.R: tabs_as_spaces(string.n, c(2, 3, 4, 8))
                                                                                  
   8/10 tabs.R: tabs_as_spaces(string.n, c(2, 8))
                                                                                  
   8/10 tabs.R: tabs_as_spaces("")
                                                                                  
   8/10 tabs.R: tabs_as_spaces("\t")
                                                                                  
   8/10 tabs.R: tabs_as_spaces("\n")
                                                                                  
   8/10 tabs.R: tabs_as_spaces(c(string, string, string))
                                                                                  
   8/10 tabs.R: tabs_as_spaces(string, warn = 1:3)
                                                                                  
   8/10 tabs.R: tabs_as_spaces(string, tab.stops = "hello")
                                                                                  
   8/10 tabs.R: tabs_as_spaces(string, ctl = "hello")
                                                                                  
   8/10 tabs.R: tabs_as_spaces(string, ctl = 0)
                                                                                  
  
                                                                                  
   9/10 tohtml.R: 
                                                                                  
   9/10 tohtml.R: library(unitizer)
                                                                                  
   9/10 tohtml.R: library(fansi)
                                                                                  
   9/10 tohtml.R: style <- "width: 16px; height: 16px; display: inline-block;"
                                                                                  
   9/10 tohtml.R: span <- "<span style=\"background-color: %s; %s\"></span>"
                                                                                  
   9/10 tohtml.R: colors.8 <- fansi:::esc_color_code_to_html(rbind(c(0:7), 0L, 
                                                                                  
   9/10 tohtml.R: colors.8
                                                                                  
   9/10 tohtml.R: fansi:::esc_color_code_to_html(matrix(c(9L, 0L, 0L, 0L, 0L)))
                                                                                  
   9/10 tohtml.R: colors.255 <- fansi:::esc_color_code_to_html(rbind(8L, 5L, 0:255
                                                                                  
   9/10 tohtml.R: colors.255
                                                                                  
   9/10 tohtml.R: vals <- c(0L, 127L, 255L)
                                                                                  
   9/10 tohtml.R: colors.tru <- fansi:::esc_color_code_to_html(do.call(rbind, c(li
                                                                                  
   9/10 tohtml.R: colors.tru
                                                                                  
   9/10 tohtml.R: as_html_page <- function(x) {
                                                                                  
   9/10 tohtml.R: sgr_to_html("hello \033[31;42;1mworld\033[0m")
                                                                                  
   9/10 tohtml.R: sgr_to_html("hello \033[31;48;5;23;1mworld\033[m")
                                                                                  
   9/10 tohtml.R: sgr_to_html("\033[1mbold\033[22m \033[2mfaint\033[22m \033[mital
                                                                                  
   9/10 tohtml.R: csi_string <- c("\033[1mbold\033[22m \033[2mfaint\033[22m \033[3
                                                                                  
   9/10 tohtml.R: html_string <- sgr_to_html(csi_string)
                                                                                  
   9/10 tohtml.R: html_string
                                                                                  
   9/10 tohtml.R: sgr_to_html("hello\033[94;101m world\033[39m yow\033[49mza")
                                                                                  
   9/10 tohtml.R: sgr_to_html("hello\033[98;101m world\033[39m yow\033[49mza")
                                                                                  
   9/10 tohtml.R: sgr_to_html("hello\033[0m")
                                                                                  
   9/10 tohtml.R: sgr_to_html("hello\033[31m")
                                                                                  
   9/10 tohtml.R: sgrs <- paste0(rep("\033[31m", 20), collapse = "")
                                                                                  
   9/10 tohtml.R: sgr_to_html(sprintf("%shello world\033[m", sgrs))
                                                                                  
   9/10 tohtml.R: sgr_to_html(1:3)
                                                                                  
   9/10 tohtml.R: fansi:::esc_color_code_to_html(matrix(1:12, 4))
                                                                                  
   9/10 tohtml.R: sgr_to_html(1:3)
                                                                                  
   9/10 tohtml.R: sgr_to_html("a", warn = 1:3)
                                                                                  
   9/10 tohtml.R: sgr_to_html("a", term.cap = 1:3)
                                                                                  
   9/10 tohtml.R: sgr_to_html("a", term.cap = "hello")
                                                                                  
   9/10 tohtml.R: string <- c("\033[31m", "\033[39m")
                                                                                  
   9/10 tohtml.R: fansi::sgr_to_html(string)
                                                                                  
   9/10 tohtml.R: string1 <- c("\033[31mhello", "world\033[39m moon")
                                                                                  
   9/10 tohtml.R: fansi::sgr_to_html(string1)
                                                                                  
   9/10 tohtml.R: string2 <- c("\033[3mhello\033[24m", "world\033[23m moon")
                                                                                  
   9/10 tohtml.R: fansi::sgr_to_html(string2)
                                                                                  
  
                                                                                  
  10/10 wrap.R: 
                                                                                  
  10/10 wrap.R: library(unitizer)
                                                                                  
  10/10 wrap.R: library(fansi)
                                                                                  
  10/10 wrap.R: hello.0 <- "hello world this is a lovely day"
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.0, width = 10)
                                                                                  
  10/10 wrap.R: hello.1 <- "hello  world  this  is.  a lovely day."
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.1, width = 10)
                                                                                  
  10/10 wrap.R: hello.2 <- "hello\rworld\rthis  is.  a lovely day."
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.2, width = 10)
                                                                                  
  10/10 wrap.R: hello.3 <- "hello\rworld\nthis  is.  a lovely\n day."
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.3, width = 10)
                                                                                  
  10/10 wrap.R: hello.4 <- "  hello  world  this  is  a lovely day."
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.4, width = 10)
                                                                                  
  10/10 wrap.R: hello.5 <- "hello.\n\n\nworld"
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.5, width = 10)
                                                                                  
  10/10 wrap.R: hello.5a <- "hello.\n \n \nworld"
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.5a, width = 10)
                                                                                  
  10/10 wrap.R: hello.6a <- "hello.\"  there"
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.6a, width = 40)
                                                                                  
  10/10 wrap.R: hello.6b <- "hello.'  there"
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.6b, width = 40)
                                                                                  
  10/10 wrap.R: hello.6c <- "hello.)  there"
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.6c, width = 40)
                                                                                  
  10/10 wrap.R: hello2.0 <- paste0("hello ", red, "world ", grn.bg, " this is a  l
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, 10)
                                                                                  
  10/10 wrap.R: strwrap_ctl(strip_ctl(hello2.0, "sgr"), 10)
                                                                                  
  10/10 wrap.R: hello2.1 <- paste0("hello \033[41mworld\033[m how are you today")
                                                                                  
  10/10 wrap.R: hello2.2 <- paste0("hello \033[41mworld\033[0m how are you today")
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.1, 15)
                                                                                  
  10/10 wrap.R: hello.bold.faint <- paste0("hello \033[1mbolded once upon a time\0
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.bold.faint, 10)
                                                                                  
  10/10 wrap.R: hello.blinky <- paste0("hello \033[5mbliking slowly oh my\033[25m 
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.blinky, 10)
                                                                                  
  10/10 wrap.R: hello2.3 <- c(hello2.1, hello2.2)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.3, 10, simplify = FALSE)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.3, 10, simplify = FALSE)
                                                                                  
  10/10 wrap.R: wrap.csi <- strwrap_ctl(lorem.r.thanks, 40)
                                                                                  
  10/10 wrap.R: nchar(strip_ctl(wrap.csi, "sgr"))
                                                                                  
  10/10 wrap.R: nchar(wrap.csi)
                                                                                  
  10/10 wrap.R: strwrap_ctl("hello \033kworld yohoo", 12)
                                                                                  
  10/10 wrap.R: strwrap_ctl("hello \033\nworld yohoo", 12)
                                                                                  
  10/10 wrap.R: strwrap_ctl("hello\037\037\037\037\037\037 world yohoo", 12)
                                                                                  
  10/10 wrap.R: strwrap_ctl("hello \033[999mworld", 6)
                                                                                  
  10/10 wrap.R: strwrap_ctl("hello \033[31#31mworld", 6)
                                                                                  
  10/10 wrap.R: strwrap_ctl("hello \033[999nworld", 6)
                                                                                  
  10/10 wrap.R: strwrap_ctl("hello \033[999mworld", 6, warn = FALSE)
                                                                                  
  10/10 wrap.R: strwrap_ctl("hello \033[31#31mworld", 6, warn = FALSE)
                                                                                  
  10/10 wrap.R: strwrap_ctl("hello \033[999nworld", 6, warn = FALSE)
                                                                                  
  10/10 wrap.R: lorem.sentence <- unlist(strsplit_ctl(lorem, "[.]\\K ", perl = TRU
                                                                                  
  10/10 wrap.R: lorem.sentence <- gsub(",", ",\n", lorem.sentence, fixed = TRUE)
                                                                                  
  10/10 wrap.R: lorem.para <- c(paste0(lorem.sentence[1:2], collapse = "\n\n"), 
                                                                                  
  10/10 wrap.R: strwrap_ctl(lorem.para, indent = 2)
                                                                                  
  10/10 wrap.R: strwrap_ctl(lorem.para, exdent = 2)
                                                                                  
  10/10 wrap.R: strwrap_ctl(lorem.para, indent = 4, exdent = 2)
                                                                                  
  10/10 wrap.R: pre <- "\033[32m+ \033[0m"
                                                                                  
  10/10 wrap.R: ini <- "\033[33m> \033[0m"
                                                                                  
  10/10 wrap.R: hello.8a <- "hello world yohoo"
                                                                                  
  10/10 wrap.R: wrap.csi.2 <- strwrap_ctl(hello.8a, 14, prefix = pre, initial = in
                                                                                  
  10/10 wrap.R: wrap.csi.2
                                                                                  
  10/10 wrap.R: hello.8b <- c(hello.8a, "oh my this has 2 elements")
                                                                                  
  10/10 wrap.R: wrap.csi.3 <- strwrap_ctl(hello.8b, 14, prefix = pre, initial = in
                                                                                  
  10/10 wrap.R: wrap.csi.3
                                                                                  
  10/10 wrap.R: hello.9a <- "hello\t\033[41mred\033[49m\tworld"
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello.9a, 12)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello.9a, 12, tabs.as.spaces = TRUE)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello.9a, 13, tabs.as.spaces = TRUE)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello.9a, 12, tabs.as.spaces = TRUE, tab.stops = c(6,
                                                                                  
  10/10 wrap.R: r.thanks <- lorem.r.thanks.2
                                                                                  
  10/10 wrap.R: bg <- ceiling(seq_along(r.thanks)/length(r.thanks) * 215) + 16
                                                                                  
  10/10 wrap.R: fg <- ifelse((((bg - 16)%/%18)%%2), 30, 37)
                                                                                  
  10/10 wrap.R: tpl <- "\033[%d;48;5;%dm%s\033[49m"
                                                                                  
  10/10 wrap.R: nz <- nzchar(r.thanks)
                                                                                  
  10/10 wrap.R: r.thanks[nz] <- sprintf(tpl, fg[nz], bg[nz], r.thanks[nz])
                                                                                  
  10/10 wrap.R: r.col <- paste0(r.thanks, collapse = "\n")
                                                                                  
  10/10 wrap.R: r.wrap <- strwrap2_ctl(r.col, 35, pad.end = " ", wrap.always = TRU
                                                                                  
  10/10 wrap.R: r.wrap
                                                                                  
  10/10 wrap.R: hello.9b <- "\033[41mhello\n\nworld."
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello.9b, 8, pad.end = " ")
                                                                                  
  10/10 wrap.R: hello.9b <- "  \033[41mhello world."
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello.9b, 8, strip.spaces = FALSE)
                                                                                  
  10/10 wrap.R: hello.9c <- "\033[41m  hello world."
                                                                                  
  10/10 wrap.R: ws.0 <- "hello   worldza"
                                                                                  
  10/10 wrap.R: ws.1 <- "hello \t worldza"
                                                                                  
  10/10 wrap.R: ws.2 <- "hello \n worldza"
                                                                                  
  10/10 wrap.R: strwrap2_sgr(ws.0, 7, strip.spaces = FALSE)
                                                                                  
  10/10 wrap.R: strwrap2_sgr(ws.0, 7, strip.spaces = FALSE, wrap.always = TRUE)
                                                                                  
  10/10 wrap.R: strwrap2_sgr(ws.0, 6, strip.spaces = FALSE)
                                                                                  
  10/10 wrap.R: strwrap2_sgr(ws.0, 6, strip.spaces = FALSE, wrap.always = TRUE)
                                                                                  
  10/10 wrap.R: strwrap2_sgr(ws.1, 7, strip.spaces = FALSE)
                                                                                  
  10/10 wrap.R: strwrap2_sgr(ws.1, 7, strip.spaces = FALSE, wrap.always = TRUE)
                                                                                  
  10/10 wrap.R: strwrap2_sgr(ws.1, 6, strip.spaces = FALSE)
                                                                                  
  10/10 wrap.R: strwrap2_sgr(ws.1, 6, strip.spaces = FALSE, wrap.always = TRUE)
                                                                                  
  10/10 wrap.R: strwrap2_sgr(" hello world ", 7, strip.spaces = FALSE)
                                                                                  
  10/10 wrap.R: strwrap2_sgr("\thello\tworld\t", 7, strip.spaces = FALSE)
                                                                                  
  10/10 wrap.R: strwrap2_sgr("\nhello\nworld\n", 7, strip.spaces = FALSE)
                                                                                  
  10/10 wrap.R: hello.9e <- c("hello\t\033[91mworld\033[m\t\033[38;2;31;42;4mworld
                                                                                  
  10/10 wrap.R: strwrap_sgr(hello.9e, 12, term.cap = "256")
                                                                                  
  10/10 wrap.R: hello.9f <- "hello \033[91mworld boohaythereyowza"
                                                                                  
  10/10 wrap.R: strwrap2_sgr(hello.9f, 12, prefix = "++", initial = ">>", wrap.alw
                                                                                  
  10/10 wrap.R: strwrap2_sgr(hello.9e, 12, tabs.as.spaces = TRUE, tab.stops = c(6,
                                                                                  
  10/10 wrap.R: strwrap_sgr(hello.9e, 12, warn = FALSE, indent = 2, exdent = 1, 
                                                                                  
  10/10 wrap.R: strwrap_sgr(hello.9e, 12, indent = 2, exdent = 1, prefix = "++", 
                                                                                  
  10/10 wrap.R: hello.long <- "\033[31mhelloworld\033[mlongword"
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.long, 8)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello.long, 8, wrap.always = TRUE)
                                                                                  
  10/10 wrap.R: hello.border <- c("hello \033[51mworld woohoo\033[54m woohoo", 
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.border, 12)
                                                                                  
  10/10 wrap.R: hello.ideogram <- c("hello \033[60mworld woohoo\033[65m woohoo", 
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.ideogram, 12)
                                                                                  
  10/10 wrap.R: hello.font <- c("hello \033[10mworld woohoo\033[10m woohoo", 
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.font, 12)
                                                                                  
  10/10 wrap.R: getOption("fansi.term.cap")
                                                                                  
  10/10 wrap.R: hello.bright <- "\033[42mhello \033[103mworld wowza\033[49m"
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.bright, 13)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.bright, 13, term.cap = character())
                                                                                  
  10/10 wrap.R: hello.255 <- "\033[42mhello \033[48;5;47mworld wowza\033[49m"
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.255, 13)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.255, 13, term.cap = character())
                                                                                  
  10/10 wrap.R: hello.tru <- "\033[42mhello \033[48;2;7;41;4mworld wowza\033[m"
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.tru, 13, term.cap = "truecolor")
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello.tru, 13)
                                                                                  
  10/10 wrap.R: strwrap_ctl("a", -1)
                                                                                  
  10/10 wrap.R: strwrap2_ctl("a", -1)
                                                                                  
  10/10 wrap.R: strwrap2_ctl("a", -1, wrap.always = TRUE)
                                                                                  
  10/10 wrap.R: strwrap2_ctl("a", 0, wrap.always = TRUE)
                                                                                  
  10/10 wrap.R: strwrap2_ctl("a", 1, wrap.always = TRUE)
                                                                                  
  10/10 wrap.R: tryCatch(strwrap_ctl("hello world", 6, prefix = "\033p"), warning 
                                                                                  
  10/10 wrap.R: suppressWarnings(strwrap_ctl("hello world", 6, prefix = "\033p"))
                                                                                  
  10/10 wrap.R: tryCatch(strwrap2_ctl("hello world", 8, pad.end = "\t"), error = c
                                                                                  
  10/10 wrap.R: tryCatch(strwrap2_ctl("hello world", 8, pad.end = "  "), error = c
                                                                                  
  10/10 wrap.R: strwrap2_ctl("goodbye moon", 8, indent = 5, prefix = "> hello >")
                                                                                  
  10/10 wrap.R: strwrap2_ctl("goodbye moon", 16, indent = 5, prefix = "> hello >",
                                                                                  
  10/10 wrap.R: tryCatch(strwrap2_ctl("goodbye moon", 15, indent = 5, prefix = "> 
                                                                                  
  10/10 wrap.R: strwrap_ctl(1:3)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, width = "35")
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, width = NA_integer_)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, indent = NA_integer_)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, indent = -3)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, exdent = -3)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, exdent = 1:3)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, prefix = 1:3)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, initial = 1:3)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, warn = NULL)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, term.cap = 1:3)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, term.cap = "bananas")
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, ctl = 1:3)
                                                                                  
  10/10 wrap.R: strwrap_ctl(hello2.0, ctl = "bananas")
                                                                                  
  10/10 wrap.R: strwrap2_ctl(1:3)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, width = "35")
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, width = NA_integer_)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, indent = NA_integer_)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, indent = -3)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, exdent = -3)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, exdent = 1:3)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, prefix = 1:3)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, initial = 1:3)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, warn = NULL)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, term.cap = 1:3)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, term.cap = "bananas")
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, ctl = 1:3)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, ctl = "bananas")
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, wrap.always = 1:3)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, wrap.always = NA)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, tabs.as.spaces = NA)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, tabs.as.spaces = 1)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, tab.stops = -(1:3))
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, tab.stops = 0)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, strip.spaces = 1:3)
                                                                                  
  10/10 wrap.R: strwrap2_ctl(hello2.0, tabs.as.spaces = TRUE, strip.spaces = TRUE)
                                                                                  
  
                                                                                  
  Prepping Unitizers...Warning in history_capt(history) :
    Unable to capture history in non-interactive mode.
  
                                                                                  
  | Summary of files in common directory 'unitizer':
  | 
  |                  Pass Fail
  |   1.      has.R    30    -
  |   2.     misc.R    88    -
  |   3.    nchar.R    34    -
  |   4. overflow.R    21    -
  |   5.    strip.R    66    -
  |   6. strsplit.R    33    -
  |   7.   substr.R    82    -
  |   8.     tabs.R    15    -
  |   9.   tohtml.R    22    -
  |  10.     wrap.R   116    -
  | ..........................
  |                   507    -
  
  | 507/507 tests passed; nothing to review.
  
  
  
                                                                                  
  Preloads...
                                                                                  
  Loading unitizer data...
                                                                                  
  Parsing tests...
                                                                                  
  Parsing unitizer/utf8.R
                                                                                  
  
                                                                                  
  library(fansi)
                                                                                  
  term.cap <- c("bright", "256", "truecolor")
                                                                                  
  lorem.cn.pieces <- substr(rep(lorem.cn, 5), c(1, 11, 21, 31), 
                                                                                  
  lorem.cn.col.1 <- paste0(red, lorem.cn.pieces[1], inv, lorem.cn.pieces[2], 
                                                                                  
  lor.cn.c.1.5 <- rep(lorem.cn.col.1, 5)
                                                                                  
  starts <- seq(1, 17, 4)
                                                                                  
  ends <- starts + 3
                                                                                  
  substr2_ctl(lor.cn.c.1.5, starts, ends, term.cap = term.cap)
                                                                                  
  lorem.cn.col.2 <- paste0(red, lorem.cn.pieces[1], "hello", inv, 
                                                                                  
  lor.cn.c.2.5 <- rep(lorem.cn.col.2, 5)
                                                                                  
  starts <- seq(1, by = 6, length.out = 5)
                                                                                  
  ends <- starts + 5
                                                                                  
  substr2_ctl(lor.cn.c.2.5, starts, ends, term.cap = term.cap)
                                                                                  
  substr2_sgr(lor.cn.c.2.5, starts, ends, term.cap = term.cap)
                                                                                  
  starts <- seq(1, by = 12, length.out = 5)
                                                                                  
  ends <- starts + 11
                                                                                  
  substr2_ctl(lor.cn.c.2.5, starts, ends, type = "width", term.cap = term.cap)
                                                                                  
  lorem.cn.col.4 <- paste0(red, lorem.cn.pieces[1], "hello", inv, 
                                                                                  
  lor.cn.c.4.5 <- rep(lorem.cn.col.4, 5)
                                                                                  
  substr2_ctl(lor.cn.c.4.5, starts, ends, type = "width")
                                                                                  
  lorem.cn.col.3 <- paste0(red, lorem.cn.pieces[1], "helloo", inv, 
                                                                                  
  lor.cn.c.3.5 <- rep(lorem.cn.col.3, 5)
                                                                                  
  starts <- seq(1, by = 12, length.out = 5)
                                                                                  
  ends <- starts + 10
                                                                                  
  ends[2] <- 24
                                                                                  
  substr2_ctl(lor.cn.c.3.5, starts, ends, type = "width", term.cap = term.cap)
                                                                                  
  substr2_ctl(lor.cn.c.3.5, starts, ends, type = "width", round = "both", 
                                                                                  
  starts <- seq(1, by = 7, length.out = 5)
                                                                                  
  ends <- starts + 8
                                                                                  
  substr2_ctl(lor.cn.c.1.5, starts, ends, type = "width", term.cap = term.cap)
                                                                                  
  substr2_ctl(lor.cn.c.1.5, starts, ends, type = "width", round = "stop", 
                                                                                  
  bytes <- "\xc0\xb1\xf0\xb1\xc0\xb1\xc0\xb1"
                                                                                  
  Encoding(bytes) <- "bytes"
                                                                                  
  tce(substr_ctl(bytes, 2, 3))
                                                                                  
  latin <- "H\xe9llo W\xd6rld!"
                                                                                  
  Encoding(latin) <- "latin1"
                                                                                  
  latin.utf8 <- substr_ctl(latin, 1, 9)
                                                                                  
  latin.utf8
                                                                                  
  Encoding(latin.utf8)
                                                                                  
  substr2_ctl(lorem.cn.col.2, 1, 2, type = "width")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 1, 3, type = "width")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 2, 3, type = "width")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 2, 4, type = "width")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 3, 4, type = "width")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 1, 2, type = "width", round = "stop")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 1, 3, type = "width", round = "stop")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 2, 3, type = "width", round = "stop")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 2, 4, type = "width", round = "stop")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 3, 4, type = "width", round = "stop")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 1, 2, type = "width", round = "both")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 1, 3, type = "width", round = "both")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 2, 3, type = "width", round = "both")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 2, 4, type = "width", round = "both")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 3, 4, type = "width", round = "both")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 1, 2, type = "width", round = "neither")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 1, 3, type = "width", round = "neither")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 2, 3, type = "width", round = "neither")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 2, 4, type = "width", round = "neither")
                                                                                  
  substr2_ctl(lorem.cn.col.2, 3, 4, type = "width", round = "neither")
                                                                                  
  lor.cn.2.2 <- rep(lorem.cn.col.2, 2)
                                                                                  
  substr2_ctl(lor.cn.2.2, c(1, 3), c(2, 4), type = "width")
                                                                                  
  substr2_ctl(lor.cn.2.2, c(2, 4), c(2, 4), type = "width")
                                                                                  
  combo <- "hellò͜ world"
                                                                                  
  Encoding(combo) <- "UTF-8"
                                                                                  
  substr2_ctl(combo, 1, 5, type = "width")
                                                                                  
  substr2_ctl(combo, 5, 8, type = "width")
                                                                                  
  substr2_ctl(rep(combo, 2), c(1, 5), c(5, 8), type = "width")
                                                                                  
  combo1 <- "hellò͜"
                                                                                  
  Encoding(combo1) <- "UTF-8"
                                                                                  
  substr2_ctl(combo, 1, 5, type = "width")
                                                                                  
  substr2_ctl(combo, 2, 6, type = "width")
                                                                                  
  combo3 <- paste0(substr(lorem.cn.pieces[1], 1, 2), "̀")
                                                                                  
  Encoding(combo3) <- "UTF-8"
                                                                                  
  substr2_ctl(combo3, 3, 4, type = "width")
                                                                                  
  substr2_ctl(combo3, 2, 4, type = "width")
                                                                                  
  substr2_ctl(combo3, 4, 4, type = "width")
                                                                                  
  substr2_ctl(combo3, 4, 5, type = "width")
                                                                                  
  combo4 <- paste0("̀hello")
                                                                                  
  substr2_ctl(combo4, 1, 1, type = "width")
                                                                                  
  substr2_ctl(combo4, 1, 1)
                                                                                  
  flags <- "🇦🇷🇦🇴🇦🇮"
                                                                                  
  nchar(flags, type = "chars")
                                                                                  
  nchar(flags, type = "width")
                                                                                  
  nchar_ctl(flags, type = "chars")
                                                                                  
  nchar_ctl(flags, type = "width")
                                                                                  
  nchar(substr2_ctl(flags, 1, 2))
                                                                                  
  nchar(substr2_ctl(flags, 1, 2, type = "width"))
                                                                                  
  utf8.bad <- "hello \xf0 world, goodnight moon"
                                                                                  
  Encoding(utf8.bad) <- "UTF-8"
                                                                                  
  fansi:::state_at_pos(utf8.bad, 1, 7)
                                                                                  
  fansi:::state_at_pos(utf8.bad, 5, 10)
                                                                                  
  tryCatch(substr2_ctl(utf8.bad, 1, 7, type = "width"), warning = function(e) cond
                                                                                  
  tryCatch(substr2_ctl(utf8.bad, 5, 10, type = "width"), warning = function(e) con
                                                                                  
  chrs.2 <- "hello\xee"
                                                                                  
  Encoding(chrs.2) <- "UTF-8"
                                                                                  
  tryCatch(substr2_ctl(chrs.2, 1, 10, type = "width"), warning = function(e) condi
                                                                                  
  b.test <- c("샶뻙", "́a뻙", "뻙́a", "뻙á")
                                                                                  
  identical(substr_ctl(b.test, 0, 3), substr(b.test, 0, 3))
                                                                                  
  identical(substr_ctl(b.test, 0, 2), substr(b.test, 0, 2))
                                                                                  
  identical(substr_ctl(b.test, 1, 2), substr(b.test, 1, 2))
                                                                                  
  identical(substr_ctl(b.test, 0, 4), substr(b.test, 0, 4))
                                                                                  
  identical(substr_ctl(b.test, 4, 4), substr(b.test, 4, 4))
                                                                                  
  b.t.c <- sprintf("\033[43m%s\033[49m", b.test)
                                                                                  
  substr_ctl(b.t.c, 0, 0)
                                                                                  
  substr_ctl(b.t.c, 0, 2)
                                                                                  
  substr_ctl(b.t.c, 1, 2)
                                                                                  
  substr_ctl(b.t.c, 0, 4)
                                                                                  
  substr_ctl(b.t.c, 4, 4)
                                                                                  
  substr2_ctl(b.t.c, 0, 0, type = "width")
                                                                                  
  substr2_ctl(b.t.c, 0, 5, type = "width")
                                                                                  
  substr2_ctl(b.t.c, 5, 5, type = "width")
                                                                                  
  chr.dia <- "Å"
                                                                                  
  nchar_ctl(chr.dia)
                                                                                  
  nchar(chr.dia)
                                                                                  
  nchar_ctl(chr.dia, type = "width")
                                                                                  
  w1 <- "一丁七"
                                                                                  
  w2 <- "一丁七"
                                                                                  
  nchar_ctl(w1)
                                                                                  
  nchar_ctl(w2, type = "width")
                                                                                  
  hello.illegal <- c("hello", "\xf0", "\xf0aaaa")
                                                                                  
  Encoding(hello.illegal) <- "UTF-8"
                                                                                  
  nchar_ctl(hello.illegal)
                                                                                  
  nchar_ctl(hello.illegal, allowNA = TRUE)
                                                                                  
  nzchar_ctl(hello.illegal)
                                                                                  
  esc.1 <- sprintf("hello \033[31mworld\033[m%s\033[48;5;123m blahs \033[m%s", 
                                                                                  
  Encoding(esc.1) <- "UTF-8"
                                                                                  
  nchar_ctl(esc.1)
                                                                                  
  nchar_ctl(esc.1, type = "width")
                                                                                  
  nzchar_ctl(esc.1)
                                                                                  
  esc.2 <- "\n\r\033P\033[31m\a"
                                                                                  
  nchar_ctl(c(esc.1, esc.2, "hello"), warn = FALSE)
                                                                                  
  esc.4 <- c(sprintf("\033[31m%s\thello", w1), NA, hello.illegal)
                                                                                  
  nchar_sgr(esc.4, type = "width", keepNA = FALSE, warn = FALSE, 
                                                                                  
  nzchar_sgr(esc.4, keepNA = FALSE, warn = FALSE)
                                                                                  
  utf8.bad.0 <- "hello\033\033\033[45p \xf0how wor\ald"
                                                                                  
  Encoding(utf8.bad.0) <- "UTF-8"
                                                                                  
  unhandled_ctl(utf8.bad.0)
                                                                                  
  utf8.bad.1 <- "hello \xf0ho"
                                                                                  
  Encoding(utf8.bad.1) <- "UTF-8"
                                                                                  
  unhandled_ctl(utf8.bad.1)
                                                                                  
  chrs <- c("\u0080", "߿", "ࠀ", "\u0fff", "က", "쿿", "퀀", 
                                                                                  
  Encoding(chrs) <- "UTF-8"
                                                                                  
  nchar(chrs, allowNA = TRUE)
                                                                                  
  nchar_ctl(chrs, allowNA = TRUE)
                                                                                  
  utf8.bad.2 <- "\xbfaaaaaa"
                                                                                  
  Encoding(utf8.bad.2) <- "UTF-8"
                                                                                  
  nchar(utf8.bad.2, allowNA = TRUE)
                                                                                  
  nchar_ctl(utf8.bad.2, allowNA = TRUE)
                                                                                  
  fansi:::state_at_pos(utf8.bad.2, 1, 1)
                                                                                  
  pre.2 <- "\033[32mП \033[0m"
                                                                                  
  ini.2 <- "\033[33mр \033[0m"
                                                                                  
  hello.8c <- "hello Привет world"
                                                                                  
  Encoding(pre.2) <- "UTF-8"
                                                                                  
  Encoding(ini.2) <- "UTF-8"
                                                                                  
  Encoding(hello.8c) <- "UTF-8"
                                                                                  
  pre.3 <- "П "
                                                                                  
  ini.3 <- "р "
                                                                                  
  Encoding(pre.3) <- "UTF-8"
                                                                                  
  Encoding(ini.3) <- "UTF-8"
                                                                                  
  wrap.csi.4 <- strwrap_ctl(hello.8c, 15, prefix = pre.2, initial = ini.2)
                                                                                  
  wrap.csi.4
                                                                                  
  utf8.chr <- "直"
                                                                                  
  strwrap2_ctl(utf8.chr, 1, wrap.always = TRUE)
                                                                                  
  strwrap2_ctl(utf8.chr, 2, wrap.always = TRUE)
                                                                                  
  strwrap2_ctl(utf8.chr, 3, wrap.always = TRUE)
                                                                                  
  strwrap_ctl("lovelyday.", 10)
                                                                                  
  strwrap2_ctl("lovelyday.", 10, wrap.always = TRUE)
                                                                                  
  utf8.bad <- "hello \xf0 world, goodnight moon"
                                                                                  
  Encoding(utf8.bad) <- "UTF-8"
                                                                                  
  strwrap_ctl(utf8.bad, 10)
                                                                                  
  utf8.bad.2 <- "\xf0"
                                                                                  
  Encoding(utf8.bad.2) <- "UTF-8"
                                                                                  
  tcw(strwrap_ctl("hello world", 6, prefix = utf8.bad.2))
                                                                                  
  suppressWarnings(strwrap_ctl("hello world", 6, prefix = utf8.bad.2))
                                                                                  
  bytes <- "\xc0\xb1\xf0\xb1\xc0\xb1\xc0\xb1"
                                                                                  
  Encoding(bytes) <- "bytes"
                                                                                  
  tce(strwrap_ctl(bytes))
                                                                                  
  wrap.mix <- strwrap_ctl(lorem.mix, 25)
                                                                                  
  wrap.mix
                                                                                  
  string <- "\033[37;48;5;32m國官方認定的民族現有56個\033[39;49m"
                                                                                  
  Encoding(string) <- "UTF-8"
                                                                                  
  strwrap2_ctl(string, 24, wrap.always = TRUE, pad.end = " ")
                                                                                  
  string3 <- c("\033[38;5;246m# … with 5 more variables: total_time \033[3m\033[38
                                                                                  
  Encoding(string3) <- "UTF-8"
                                                                                  
  fansi::sgr_to_html(string3)
                                                                                  
  string4 <- c("wow \033[31m then", "hello\033[\x80;wow", "yo \033[m there", 
                                                                                  
  Encoding(string4) <- "UTF-8"
                                                                                  
  sgr_to_html(string4)
                                                                                  
  
                                                                                  
  Prepping Unitizers...Warning in history_capt(history) :
    Unable to capture history in non-interactive mode.
  
                                                                                  
  +------------------------------------------------------------------------------+
  | unitizer for: unitizer/utf8.R                                                |
  +------------------------------------------------------------------------------+
  
                                Pass Fail
                        substr    12    -
                      rounding    20    -
                    multi-elem     2    -
          zero width combining    11    -
               Emoji combining     6    -
                  Corner cases    18    -
                         nchar    13    1
                     unhandled     2    -
                      utf8clen     5    -
             wrap corner cases    10    -
   wrap with wide UTF8 and ESC     2    -
                  issue 54 ctd     2    -
  .......................................
                                 103    1
  
  = nchar ========================================================================
  
  - Failed -----------------------------------------------------------------------
  
  | The following test failed because the new evaluation does not match the 
  | reference value from the store. Overwrite with new result ([Y]es, [N]o, 
  | [P]rev, [B]rowse, [R]erun, [Q]uit, [H]elp)?
  
  # _sgr
  
  > esc.4 <- c(sprintf("\033[31m%s\thello", w1), NA, hello.illegal)
  > nchar_sgr(esc.4, type = "width", keepNA = FALSE, warn = FALSE, 
  +     allowNA = TRUE)
  [1] 11  2  5 NA NA
  
  | Value mismatch: 
  
  < .ref                > .new              
  @@ 1 @@               @@ 1 @@             
  < [1] 12  2  5 NA NA  > [1] 11  2  5 NA NA
  
  | State mismatch; see `.DIFF$state` for details.
  
  | User input required to proceed, but we are in non-interactive mode.
  
  | unitizer unchanged.
  
  |   * Fail: nchar_sgr(esc.4, type = "width", keepNA = FALSE, warn = FALSE, 
  |     allowNA = TRUE)
  | in 'unitizer/utf8.R'
  
  | Newly evaluated tests do not match unitizer (Pass: 103, Fail: 1); see above 
  | for more info, or run in interactive mode.
  
  Error in unitize_core(test.file.inf, list(store.id.inf), state = state,  : 
    Cannot proceed in non-interactive mode.
  Calls: unitize -> unitize_core
  Execution halted