Skip to content

Commit 6efc351

Browse files
enhance test 2
1 parent f17a9a4 commit 6efc351

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

inst/tests/tests.Rraw

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21195,9 +21195,13 @@ test(2319.2, !is.null(attr(dt_get0, ".internal.selfref")))
2119521195

2119621196
# Improved fread error handling for cmd exe and decompression #5415
2119721197
test(2320.1, fread(cmd="false"), error="External command failed with exit code") # external command execution error handling
21198+
2119821199
if (test_R.utils) {
21199-
corrupted_data <- c(0x1F, 0x8B, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, rep(0xFF, 50), 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF)
21200-
writeBin(as.raw(corrupted_data), f<-tempfile(fileext=".csv.gz"))
21201-
test(2320.2, fread(f), error="R.utils::decompressFile failed to decompress") # Compressed file decompression error handling
21202-
unlink(f)
21200+
tmp <- tempfile(fileext=".csv.gz")
21201+
file.create(tmp)
21202+
conn <- file(tmp, 'wb')
21203+
writeBin(as.raw(c(31, 139)), conn)
21204+
close(conn)
21205+
test(2320.2, fread(tmp), error="R.utils::decompressFile failed to decompress") # Compressed file decompression error handling
21206+
unlink(tmp)
2120321207
}

0 commit comments

Comments
 (0)