From 315ab544d33a88b916fa5316be5ff5964c3e7e1c Mon Sep 17 00:00:00 2001 From: aitap Date: Fri, 11 Oct 2024 16:03:27 +0000 Subject: [PATCH] tests: Detect session encoding incapable of U+00F1 (#6567) iconv() does not necessarily fail to convert U+00F1 to ASCII. For example, FreeBSD iconv() succeeds and returns '?' instead of the character in question. Use identical() to compare the result of the conversion back to the original (which internally converts both to UTF-8). --- inst/tests/tests.Rraw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index f79bec0d7f..c530b2fd12 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -18768,7 +18768,7 @@ if (test_bit64) local({ # non-ASCII plain symbol in by, #4708 # NB: recall we can't use non-ASCII symbols in the test script. The text is a--o (year in Spanish) native_ano = iconv("a\U00F1o", "UTF-8", "") -if (!is.na(native_ano)) { # #6339: symbol must be represented in native encoding +if (identical(native_ano, "a\U00F1o")) { # #6339: symbol must be represented in native encoding DT = data.table(a = rep(1:3, 2)) setnames(DT, "a", native_ano) test(2266, eval(parse(text=sprintf("DT[ , .N, %s]$N[1L]", native_ano))), 2L)