Skip to content

Commit ed9ec3e

Browse files
aitapMichaelChirico
andcommitted
Fix tests
- Correct encoding of source string in non-UTF-8 locale - Use nlevels(.) instead of length(levels(.)) Co-Authored-By: Michael Chirico <[email protected]>
1 parent 4cc77c6 commit ed9ec3e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

inst/tests/tests.Rraw

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21115,6 +21115,6 @@ DF = structure(list(a = 1:2), class = c("data.frame", "no.reset"), row.names = c
2111521115
test(2310.01, as.data.table(DF), data.table(a=1:2))
2111621116

2111721117
# memrecycle() did not consider string encodings for factor levels #6886
21118-
DT = data.table(factor(rep(enc2utf8('ø'), 3)))
21119-
DT[1,V1 := iconv('ø', to='latin1')]
21120-
test(2311, length(levels(DT$V1)), 1L)
21118+
DT = data.table(factor(rep(enc2utf8("\uf8"), 3)))
21119+
DT[1, V1 := iconv(levels(V1), from = "UTF-8", to = "latin1")]
21120+
test(2311, nlevels(DT$V1), 1L)

0 commit comments

Comments
 (0)