Skip to content

Commit f93fce1

Browse files
Make as.character() explicit in both cases
1 parent f32b128 commit f93fce1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

R/test.data.table.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,15 +672,15 @@ test = function(num, x, y=TRUE,
672672
if (!fail) {
673673
catf("Test %s ran without errors but failed check that x equals y:\n", numStr)
674674
failPrint = function(x, y, xsub) {
675-
label = substitute(x)
675+
label = as.character(substitute(x))
676676
cat(">", label, "=", xsub, "\n") # notranslate
677677
if (is.data.table(x)) compactprint(x) else {
678678
if (is.atomic(x)) {
679679
total = length(x)
680680
diff_idx = which(x != y | xor(is.na(x), is.na(y))) # careful to only evaluate '!=' for atomic inputs; which: drop NA-NA
681681
x = x[diff_idx]
682682
nn = length(x)
683-
names(x) = sprintf("%s[%d]", as.character(label), diff_idx)
683+
names(x) = sprintf("%s[%d]", label, diff_idx)
684684
catf("First %d different of %d (%d total, type '%s'): \n", min(nn, 6L), nn, total, typeof(x))
685685
} else {
686686
nn = length(x)

0 commit comments

Comments
 (0)