Debian Codegraph @

tests/testthat/test-hash.R

raw
1
2 test_that("whitespace does not affect hash", {
3
4 descpath <- renv_tests_path("packages/breakfast/DESCRIPTION")
5 contents <- readLines(descpath)
6 hash <- renv_hash_description(descpath)
7
8 # NOTE: this also implies that the hash should be stable
9 # across different versions of R
10 expect_identical(hash, "0fcd2a795901b4b21326a3e35442c97c")
11
12 renv_scope_tempdir()
13 descpath <- file.path(getwd(), "DESCRIPTION")
14
15 for (whitespace in c(" ", "\t")) {
16 writeLines(paste(contents, whitespace), descpath)
17 expect_identical(renv_hash_description(descpath), hash)
18 }
19
20 })
21
22 test_that("hash outputs do not change over time", {
23
24 descpath <- file.path(getwd(), "resources/DESCRIPTION")
25 hash <- renv_hash_description(descpath)
26 expect_equal(hash, "2edf28b7db72297da02d913babfc1ef3")
27
28 })