Skip to content

Commit

Permalink
tests: Add tests for set_echo
Browse files Browse the repository at this point in the history
  • Loading branch information
MEO265 committed Jun 7, 2024
1 parent 105fc58 commit 402bf42
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/testthat/test-configurations.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,16 @@ test_that("test timestamp configuration", {
expect_silent(set_timestamp_format(ts_format = old, confirm = FALSE))
expect_identical(get_timestamp_format(), old)
})

test_that("test echo configuration", {
old <- get_echo()
on.exit(set_echo(old, confirm = FALSE))

expect_message(set_echo(echo = TRUE), regexp = "Echo set to TRUE.")
expect_output(message("test"), regexp = "\"test\\n\"" , fixed = TRUE)

Check warning on line 36 in tests/testthat/test-configurations.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-configurations.R,line=36,col=56,[commas_linter] Commas should never have a space before.

Check warning on line 36 in tests/testthat/test-configurations.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-configurations.R,line=36,col=56,[commas_linter] Commas should never have a space before.
expect_output(message("test", echo = FALSE), regexp = NA)

expect_silent(set_echo(echo = FALSE, confirm = FALSE))
expect_output(message("test", echo = TRUE), regexp = "\"test\\n\"" , fixed = TRUE)

Check warning on line 40 in tests/testthat/test-configurations.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-configurations.R,line=40,col=69,[commas_linter] Commas should never have a space before.

Check warning on line 40 in tests/testthat/test-configurations.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-configurations.R,line=40,col=69,[commas_linter] Commas should never have a space before.
expect_output(message("test"), regexp = NA)
})

0 comments on commit 402bf42

Please sign in to comment.