From 3a8eeaa184298fee7dcaf764e05b3b9a8f4c8a29 Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Wed, 28 Feb 2024 08:45:48 +0000 Subject: [PATCH] lint --- tests/test-assert_package.R | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/tests/test-assert_package.R b/tests/test-assert_package.R index bf3a638..583f835 100644 --- a/tests/test-assert_package.R +++ b/tests/test-assert_package.R @@ -1,26 +1,45 @@ expect_error <- function(x, e = "") { - invisible(grepl(e, tryCatch(x, error = identity)[["message"]], fixed = TRUE) || stop("Error '", e, "' not generated")) + invisible( + grepl(e, tryCatch(x, error = identity)[["message"]], fixed = TRUE) || + stop("Error '", e, "' not generated") + ) } -expect_error(r.releases.utils::assert_package(path = c(1L, 2L)), "Invalid package file path") -expect_error(r.releases.utils::assert_package(path = tempfile()), "does not exist") +expect_error( + r.releases.utils::assert_package(path = c(1L, 2L)), + "Invalid package file path" +) + +expect_error( + r.releases.utils::assert_package(path = tempfile()), + "does not exist" +) path <- file.path(tempfile(), "hy-phens") dir.create(dirname(path)) file.create(path) -expect_error(r.releases.utils::assert_package(path = path), "invalid package name") +expect_error( + r.releases.utils::assert_package(path = path), + "invalid package name" +) unlink(dirname(path), recursive = TRUE) path <- file.path(tempfile(), "package") dir.create(dirname(path)) writeLines(letters, path) -expect_error(r.releases.utils::assert_package(path = path), "Invalid package URL") +expect_error( + r.releases.utils::assert_package(path = path), + "Invalid package URL" +) unlink(dirname(path), recursive = TRUE) path <- file.path(tempfile(), "package") dir.create(dirname(path)) writeLines("b a d", path) -expect_error(r.releases.utils::assert_package(path = path), "Found malformed URL") +expect_error( + r.releases.utils::assert_package(path = path), + "Found malformed URL" +) unlink(dirname(path), recursive = TRUE) path <- file.path(tempfile(), "package")