From 98a672bdc2b2fd394f79b8639b749d30c0bfa7d7 Mon Sep 17 00:00:00 2001 From: chainsawriot Date: Tue, 10 Sep 2024 22:25:45 +0200 Subject: [PATCH] Fix #451 --- R/utils.R | 5 +---- tests/testthat/test_trust.R | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/R/utils.R b/R/utils.R index c70ccad..feaf6c1 100644 --- a/R/utils.R +++ b/R/utils.R @@ -142,10 +142,7 @@ escape_xml <- function(x, replacement = c("&", """, "<", ">", "&a .check_trust <- function(trust, format) { if (is.null(trust)) { - lifecycle::deprecate_warn( - when = "1.0.3", - what = "import(trust = 'should be explicit for serialization formats')", - details = paste0("Missing `trust` will be set to FALSE by default for ", format, " in 2.0.0.")) + warning("Missing `trust` will be set to FALSE by default for ", format, " in 2.0.0.", call. = FALSE) trust <- TRUE ## Change this for version 2.0.0 } if (isFALSE(trust)) { diff --git a/tests/testthat/test_trust.R b/tests/testthat/test_trust.R index 2266db7..fefdf31 100644 --- a/tests/testthat/test_trust.R +++ b/tests/testthat/test_trust.R @@ -2,7 +2,7 @@ test_that("Deprecation of untrusted dump", { withr::with_tempfile("iris_file", fileext = ".dump", code = { export(iris, iris_file) ## expect deprecation to work - lifecycle::expect_deprecated(import(iris_file), regexp = "set to FALSE by default") + expect_warning(import(iris_file), regexp = "set to FALSE by default") ## expect false to error expect_error(import(iris_file, trust = FALSE)) }) @@ -12,7 +12,7 @@ test_that("Deprecation of untrusted Rdata", { withr::with_tempfile("iris_file", fileext = ".Rdata", code = { export(iris, iris_file) ## expect deprecation to work - lifecycle::expect_deprecated(import(iris_file), regexp = "set to FALSE by default") + expect_warning(import(iris_file), regexp = "set to FALSE by default") ## expect false to error expect_error(import(iris_file, trust = FALSE)) }) @@ -22,7 +22,7 @@ test_that("Deprecation of untrusted rds", { withr::with_tempfile("iris_file", fileext = ".rds", code = { export(iris, iris_file) ## expect deprecation to work - lifecycle::expect_deprecated(import(iris_file), regexp = "set to FALSE by default") + expect_warning(import(iris_file), regexp = "set to FALSE by default") ## expect false to error expect_error(import(iris_file, trust = FALSE)) }) @@ -63,7 +63,7 @@ test_that("`trust` wont cause problems for other import methods", { test_that("`trust` for import_list()", { withr::with_tempfile("iris_file", fileext = ".rdata", code = { export(iris, iris_file) - lifecycle::expect_deprecated(import_list(iris_file), regexp = "set to FALSE by default") + expect_warning(import_list(iris_file), regexp = "set to FALSE by default") expect_silent(import_list(iris_file, trust = TRUE)) expect_error(import_list(iris_file, trust = FALSE))