Skip to content

Commit

Permalink
test tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinushey committed Nov 13, 2024
1 parent 755c2d9 commit b531b02
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/testthat/test-run.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ test_that("run() can be called with arguments", {

output <- tempfile("renv-output-")
script <- renv_test_code({
writeLines(commandArgs(trailingOnly = TRUE), con = output)
tmpfile <- tempfile(pattern = "renv-script-", tmpdir = dirname(output))
writeLines(commandArgs(trailingOnly = TRUE), con = tmpfile)
file.rename(tmpfile, output)
}, list(output = output))

args <- c("--apple", "--banana", "--cherry")
Expand All @@ -19,6 +21,7 @@ test_that("run() can be called with arguments", {
)

wait(file.exists, output)
Sys.sleep(0.1)

contents <- readLines(output)
expect_equal(contents, args)
Expand Down

0 comments on commit b531b02

Please sign in to comment.