Skip to content

Commit cdabed5

Browse files
committed
tests: avoid invalid UTF-8 warning
Under options(encoding="UTF-8"), writeLines() always tries to perform text conversion. Giving it bytes that aren't valid in the current encoding results in warnings. Avoid the warning by explicitly opening a file connection with encoding="" (no conversion).
1 parent 63339e1 commit cdabed5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

inst/tests/tests.Rraw

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21555,7 +21555,9 @@ test(2333, as.expression(data.table(a = 1))[["a"]], 1)
2155521555

2155621556
# regression test for hexdigits subscript overrun (uint8_t wraps over 255, unsigned overflow is well defined in c)
2155721557
f = tempfile()
21558-
writeLines(c('a', rep('0x1.ffffp0', 10000L), '0x1.ff\x9fp0', rep('0x1.ffffp0', 20000L)), f)
21558+
ff = file(f, encoding = "")
21559+
writeLines(c('a', rep('0x1.ffffp0', 10000L), `Encoding<-`('0x1.ff\x9fp0', 'bytes'), rep('0x1.ffffp0', 20000L)), ff)
21560+
close(ff)
2155921561
test(2334, names(fread(f)), "a")
2156021562
unlink(f)
2156121563

0 commit comments

Comments
 (0)