Skip to content

Commit f4dfacb

Browse files
committed
test: add --no-update cases
1 parent 5f6e79e commit f4dfacb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/testthat/test-hooks.R

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,32 @@ run_test(
243243
}
244244
)
245245

246+
# failure with --no-update does not create WORDLIST
247+
run_test(
248+
"spell-check",
249+
suffix = "-fail.md",
250+
std_err = "Spell check failed",
251+
cmd_args = "--no-update",
252+
post_hook_assert = function(tempdir) {
253+
wordlist_path <- fs::path(tempdir, "inst", "WORDLIST")
254+
testthat::expect_false(fs::file_exists(wordlist_path))
255+
}
256+
)
257+
258+
# failure with --no-update does not update WORDLIST
259+
run_test(
260+
"spell-check",
261+
suffix = "-fail-2",
262+
std_err = "Spell check failed",
263+
cmd_args = "--no-update",
264+
artifacts = c("inst/WORDLIST" = test_path("in/WORDLIST")),
265+
post_hook_assert = function(tempdir) {
266+
words_before <- readLines(test_path("in/WORDLIST"))
267+
words_after <- readLines(fs::path(tempdir, "inst", "WORDLIST"))
268+
testthat::expect_equal(words_after, words_before)
269+
}
270+
)
271+
246272
# success with wordlist
247273
run_test("spell-check",
248274
suffix = "-wordlist-success.md",

0 commit comments

Comments
 (0)