Skip to content

Commit

Permalink
Improve snapshot tests
Browse files Browse the repository at this point in the history
It is better to write paths than printing them, because
printing will escape them, and then it is hard to
transform the path.

[ci skip]
  • Loading branch information
gaborcsardi committed Dec 11, 2024
1 parent a523e37 commit 1094132
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/scan-deps.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# get_deps_cache_path

Code
get_deps_cache_path()
writeLines(get_deps_cache_path())
Output
[1] "<tempdir>/<tempfile>/R/pkgcache/deps/1"
<tempdir>/<tempfile>/R/pkgcache/deps/1
Code
get_deps_cache_path("badcafe")
writeLines(get_deps_cache_path("badcafe"))
Output
[1] "<tempdir>/<tempfile>/R/pkgcache/deps/1/ba/badcafe"
<tempdir>/<tempfile>/R/pkgcache/deps/1/ba/badcafe

# clear_deps_cache

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-scan-deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ test_that("get_deps_cache_path", {
on.exit(unlink(tmp), add = TRUE)

expect_snapshot(transform = transform_tempdir, {
get_deps_cache_path()
get_deps_cache_path("badcafe")
writeLines(get_deps_cache_path())
writeLines(get_deps_cache_path("badcafe"))
})
})

Expand Down

0 comments on commit 1094132

Please sign in to comment.