diff --git a/R/testing.R b/R/testing.R index 5a306839a..d5f1d2b90 100644 --- a/R/testing.R +++ b/R/testing.R @@ -196,6 +196,17 @@ testthat_file <- function(...) { file.path(rprojroot::find_testthat_root_file(), ...) } +#' Convert a serialized R object to a certaion verion. +#' +#' Needed to make [testthat::exect_known_value()] work on R < 3.6. +#' @param path A path to an rds file. +#' @param version The target version. +rds_to_version <- function(path, version = 2) { + readRDS(path) %>% + saveRDS(path, version = version) +} + + #' Copy a file to a temporary directory #' diff --git a/man/rds_to_version.Rd b/man/rds_to_version.Rd new file mode 100644 index 000000000..044ea4e70 --- /dev/null +++ b/man/rds_to_version.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/testing.R +\name{rds_to_version} +\alias{rds_to_version} +\title{Convert a serialized R object to a certaion verion.} +\usage{ +rds_to_version(path, version = 2) +} +\arguments{ +\item{path}{A path to an rds file.} + +\item{version}{The target version.} +} +\description{ +Needed to make \code{\link[testthat:exect_known_value]{testthat::exect_known_value()}} work on R < 3.6. +} diff --git a/tests/testthat/public-api/xyzdir-dirty/clean-reference-with-scope-tokens-non-utf8 b/tests/testthat/public-api/xyzdir-dirty/clean-reference-with-scope-tokens-non-utf8 index fbc9b8127..46ebf02b7 100644 Binary files a/tests/testthat/public-api/xyzdir-dirty/clean-reference-with-scope-tokens-non-utf8 and b/tests/testthat/public-api/xyzdir-dirty/clean-reference-with-scope-tokens-non-utf8 differ diff --git a/tests/testthat/public-api/xyzdir-dirty/clean-reference-with-scope-tokens-utf8 b/tests/testthat/public-api/xyzdir-dirty/clean-reference-with-scope-tokens-utf8 index 807e93cd8..537854c79 100644 Binary files a/tests/testthat/public-api/xyzdir-dirty/clean-reference-with-scope-tokens-utf8 and b/tests/testthat/public-api/xyzdir-dirty/clean-reference-with-scope-tokens-utf8 differ diff --git a/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-spaces-non-utf8 b/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-spaces-non-utf8 index e49e4f0a4..daf8f8da8 100644 Binary files a/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-spaces-non-utf8 and b/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-spaces-non-utf8 differ diff --git a/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-spaces-utf8 b/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-spaces-utf8 index 4dea8b575..909ba4131 100644 Binary files a/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-spaces-utf8 and b/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-spaces-utf8 differ diff --git a/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-tokens-non-utf8 b/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-tokens-non-utf8 index a39c9c3d7..15be09f37 100644 Binary files a/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-tokens-non-utf8 and b/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-tokens-non-utf8 differ diff --git a/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-tokens-utf8 b/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-tokens-utf8 index b8ccc73c2..66be0de81 100644 Binary files a/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-tokens-utf8 and b/tests/testthat/public-api/xyzdir-dirty/dirty-reference-with-scope-tokens-utf8 differ