# Can't test directly, but we can check what character lenght we get back from
# nchar and infer whether things have changed or not
# These tests are designed to start failing if behavior of utf8clen changes

hello.8c <- "hello Ð\237Ñ\200Ð¸Ð²ÐµÑ\202 world"

wrap.csi.4 <- strwrap_ctl(hello.8c, 15, prefix = pre.2, initial = ini.2)

strwrap2_ctl(utf8.chr, 1, wrap.always = TRUE)

Width must be at least 2 in `wrap.always` mode.

Error in strwrap2_ctl(utf8.chr, 1, wrap.always = TRUE) : 
  Width must be at least 2 in `wrap.always` mode.

strwrap2_ctl(utf8.chr, 2, wrap.always = TRUE)

Wrap error: trying to wrap to width narrower than character width; set `wrap.always=FALSE` to resolve.

Error in strwrap2_ctl(utf8.chr, 2, wrap.always = TRUE) : 
  Wrap error: trying to wrap to width narrower than character width; set `wrap.always=FALSE` to resolve.

strwrap2_ctl(utf8.chr, 3, wrap.always = TRUE)

strwrap2_ctl("lovelyday.", 10, wrap.always = TRUE)

Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent,  : 
  Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`.

tcw(strwrap_ctl("hello world", 6, prefix = utf8.bad.2))

Argument `prefix` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`.

Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent,  : 
  Argument `prefix` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`.

suppressWarnings(strwrap_ctl("hello world", 6, prefix = utf8.bad.2))

encstrings <- c("hellø world", "hello wørld")

[1] "UTF-8"   "unknown" "unknown" "UTF-8"

#   strwrap(strip_ctl(lorem.mix, "sgr"), 25), strip_ctl(wrap.mix, "sgr")

strwrap2_ctl(string, 24, wrap.always = TRUE, pad.end = " ")

# other issu54 tests are in tohtml.R, but had to move this one here due to the
# ellipsis utf-8 character.

<span style='color: #949494;'># … with 5 more variables: total_time </span><span style='color: #949494; font-style: italic;'>&lt;bch:tm&gt;</span><span style='color: #949494;'>, result </span><span style='color: #949494; font-style: italic;'>&lt;list&gt;</span><span style='color: #949494;'>, memory </span><span style='color: #949494; font-style: italic;'>&lt;list&gt;</span><span style='color: #949494;'>,</span>
<span style='color: #949494;'>#   time </span><span style='color: #949494; font-style: italic;'>&lt;list&gt;</span><span style='color: #949494;'>, gc </span><span style='color: #949494; font-style: italic;'>&lt;list&gt;</span>