From 83095334a77b6a4ef8cf4a8641a22e534358e627 Mon Sep 17 00:00:00 2001 From: mutlusun Date: Fri, 8 Nov 2024 14:03:09 +0100 Subject: [PATCH] test(quarto/files): remove redundant test --- tests/testthat/test-tar_quarto_files.R | 91 +------------------------- 1 file changed, 1 insertion(+), 90 deletions(-) diff --git a/tests/testthat/test-tar_quarto_files.R b/tests/testthat/test-tar_quarto_files.R index 35a8db0..ab1260f 100644 --- a/tests/testthat/test-tar_quarto_files.R +++ b/tests/testthat/test-tar_quarto_files.R @@ -73,7 +73,7 @@ targets::tar_test("tar_quarto_files() project", { } }) -targets::tar_test("tar_quarto_files() detects non-code dependencies", { +targets::tar_test("tar_quarto_files() detects nested dependencies", { skip_quarto() fs::dir_create("report") fs::dir_create(file.path("report", "subdir")) @@ -192,92 +192,3 @@ targets::tar_test("tar_quarto_files() detects custom output file", { expect_equal(out$output, "custom.html") expect_equal(out$input, character(0)) }) - -targets::tar_test("tar_quarto_files() detects code dependencies", { - skip_quarto() - fs::dir_create("report") - fs::dir_create(file.path("report", "subdir")) - lines <- c( - "---", - "title: main", - "output_format: html", - "---", - "", - "{{< include \"text1.qmd\" >}}", - "", - "{{< include \"subdir/text2.qmd\" >}}" - ) - writeLines(lines, file.path("report", "main.qmd")) - lines <- c( - "# First File", - "", - "Contains a code cell.", - "", - "```{r}", - "1 + 1", - "```" - ) - writeLines(lines, file.path("report", "text1.qmd")) - lines <- c( - "# Second File", - "", - "Contains a code cell with a call to `tar_read`.", - "", - "```{r}", - "targets::tar_read(mytarget)", - "```" - ) - writeLines(lines, file.path("report", "subdir", "text2.qmd")) - out <- tar_quarto_files("report/main.qmd") - if (identical(tolower(Sys.info()[["sysname"]]), "windows")) { - expect_equal( - sort(basename(out$sources)), - sort("text1.qmd", "text2.qmd") - ) - expect_equal(basename(out$output), "main.html") - } else { - expect_equal( - out$sources, - sort( - c( - file.path("report", c("text1.qmd", "main.qmd")), - file.path("report", "subdir", "text2.qmd") - ) - ) - ) - expect_equal(out$output, file.path("report", "main.html")) - } - expect_equal(out$input, character()) - # Check whether we get the same result when calling via a project. - lines <- c( - "project:", - " output-dir: myoutdir", - " render:", - " - main.qmd" - ) - writeLines(lines, file.path("report", "_quarto.yml")) - out <- tar_quarto_files("report/") - if (identical(tolower(Sys.info()[["sysname"]]), "windows")) { - expect_equal( - sort(basename(out$sources)), - sort("main.qmd", "text1.qmd", "text2.qmd") - ) - expect_equal(basename(out$output), "myoutdir") - expect_equal(basename(out$input), "_quarto.yml") - } else { - expect_equal( - out$sources, - sort( - c( - file.path("report", c("text1.qmd", "main.qmd")), - file.path("report", "subdir", "text2.qmd") - ) - ) - ) - expect_equal(out$output, file.path("report", "myoutdir")) - expect_equal( - out$input, - file.path("report", "_quarto.yml") - ) - } -})