Skip to content

Commit

Permalink
tests: write_log gains unit tests (#58)
Browse files Browse the repository at this point in the history
Seems like this function didn't have any tests to begin with!

Closes #57
  • Loading branch information
jdhoffa authored Dec 6, 2024
1 parent caedd89 commit 4fd21e5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/testthat/test-write_log.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
test_that("writes to log_path as expected", {
msg <- withr::with_tempdir({
log_path <- getwd()
write_log("Hello World!", log_path)
readLines(file.path(log_path, "error_messages.txt"))
})

expect_match(msg, "Hello World!")
})

test_that("multiplication works", {
expect_warning(warn <- write_log("Hello World!"))
})

0 comments on commit 4fd21e5

Please sign in to comment.