You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RFC: fail test.data.table() if non-test code produces warnings (#7210)
* test.data.table: catch warnings outside test code
* Use explicit environment assignment instead of <<-
* Thinko: length -> nrow
* tests 2253*: suppressWarnings, skip if no UTF-8
* tests: remember tracebacks from warnings
* Thinko: length -> nrow
* suppressWarnings(Sys.setlocale(...))
On modern versions of R for Windows, Sys.setlocale() warns for non-UTF-8
locales.
Also comment the previous instance of suppressWarnings().
* Apply fixes from code review
* conditionMessage() instead of toString()
* apply names earlier
* don't check for zero-length calls in sys.calls()
* be careful not to over-translate an already-translated message
Co-Authored-By: Michael Chirico <[email protected]>
---------
Co-authored-by: Michael Chirico <[email protected]>
# triggered segfault here in #4402, Windows-only under translation.
17002
17003
# test that the argument order changes correctly (the 'item 2' moves to the beginning of the message)
@@ -18615,12 +18616,18 @@ test(2252.2, dt[, let(b=2L)], error = "\\[ was called on a data.table.*not data.
18615
18616
rm(.datatable.aware)
18616
18617
18617
18618
# tests for trunc.char handling wide characters # 5096
18618
-
local({
18619
+
local(if (l10n_info()$`UTF-8` || {
18619
18620
lc_ctype = Sys.getlocale('LC_CTYPE')
18621
+
lc_wantctype = 'en_US.UTF-8'
18620
18622
# Japanese multibyte characters require utf8. As of 2025, we're likely to be already running in a UTF-8 locale, but if not, try this setlocale() call as a last chance.
18621
18623
# Unfortunately, there is no guaranteed, portable way of switching to UTF-8 US English.
18622
-
if (!l10n_info()$`UTF-8`) Sys.setlocale('LC_CTYPE', "en_US.UTF-8")
0 commit comments