@@ -60,14 +60,14 @@ test_that("setting hash functions work", {
6060 expect_identical(cache_hash $ n , 0L )
6161
6262
63- # To override this behaviour use a generate for unique ids, such as
63+ # To override this behaviour use a function that generates globally unique ids instead of hashes
6464 cache_uid <- Cache $ new(td , hashfun = function (x ) ascending_id())
6565 cache_uid $ push(iris )
6666 cache_uid $ push(iris )
6767 expect_identical(cache_hash $ n , 2L )
6868 cache_hash $ purge()
6969
70- # ensure hashfun allways returns a scalar
70+ # fail if hashfun does not returns a scalar
7171 cache_err <- Cache $ new(td , hashfun = function (x ) c(ascending_id(), ascending_id()))
7272 expect_error(cache_err $ push(iris ), class = " ValueError" )
7373})
@@ -86,6 +86,7 @@ test_that("pruning works by number of files works", {
8686 k3 <- cache $ push(cars )
8787 expect_identical(cache $ n , 3L )
8888
89+ # cached files are sorted in the order of their creation
8990 expect_identical(cache $ files $ key [[1 ]], k1 )
9091 expect_identical(cache $ files $ key [[2 ]], k2 )
9192 expect_identical(cache $ files $ key [[3 ]], k3 )
@@ -98,7 +99,7 @@ test_that("pruning works by number of files works", {
9899
99100
100101
101- test_that(" pruning works by number of files sorts by key if timestamp are identical" , {
102+ test_that(" $ files is ordered by key if timestamps are identical" , {
102103 td <- file.path(tempdir(), " cache-test" )
103104 on.exit(unlink(td , recursive = TRUE ))
104105
0 commit comments