We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to store my snapshot files compressed with .xz, so it would be great to have something like compare_file_text_compressed.
.xz
compare_file_text_compressed
This is what I have implemented:
compare_file_text_compressed <- function(old, new) { if (compare_file_binary(old, new)) return(TRUE) old <- base::readLines(withr::local_connection(gzfile(old, open = "r")), warn = FALSE) new <- base::readLines(withr::local_connection(gzfile(new, open = "r")), warn = FALSE) identical(old, new) } save_csv_xz <- function(code, pattern) { path <- tempfile(fileext = ".csv.xz") res <- code write.table(file = withr::local_connection(xzfile(path, "w")), res, row.names = FALSE, col.names=FALSE, sep=",") path } expect_snapshot_csv_xz <- function(name, code) { # skip_on_ci() # Skip for now until we implement this: https://github.com/tidyverse/ggplot2/blob/main/tests/testthat/helper-vdiffr.R name <- paste0(name, ".csv.xz") # Announce the file before touching `code`. This way, if `code` # unexpectedly fails or skips, testthat will not auto-delete the # corresponding snapshot file. testthat::announce_snapshot_file(name = name) path <- save_csv_xz(code) testthat::expect_snapshot_file(path, name = name, compare = compare_file_text_compressed) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I would like to store my snapshot files compressed with
.xz
, so it would be great to have something likecompare_file_text_compressed
.This is what I have implemented:
The text was updated successfully, but these errors were encountered: