1
1
test_that(" local_test_setup changes back to old cache location" , {
2
+ split_path <- function (x ) {
3
+ if (Sys.info()[1 ] == " Windows" ) {
4
+ # not on other platforms as normalizePath messes up /private/var and /var
5
+ x <- normalizePath(x , mustWork = FALSE )
6
+ }
7
+ unlist(strsplit(x , .Platform $ file.sep , fixed = TRUE ))
8
+ }
2
9
withr :: defer(cache_deactivate(verbose = FALSE ))
3
10
old <- cache_info(format = " tabular" )
4
11
cache_activate(verbose = FALSE )
5
12
6
13
test <- function () {
7
14
local_test_setup()
8
- base <- unlist(strsplit( tempfile(), .Platform $ file.sep , fixed = TRUE ))[2 ]
15
+ base <- split_path( tempfile())[2 ]
9
16
expect_equal(
10
- unlist(strsplit( cache_info(format = " tabular" )$ location , .Platform $ file.sep , fixed = TRUE ) )[2 ],
17
+ split_path( cache_info(format = " tabular" )$ location )[2 ],
11
18
base
12
19
)
13
20
}
@@ -19,12 +26,19 @@ test_that("local_test_setup changes back to old cache location", {
19
26
test_that(" local_test_setup changes back to old cache location" , {
20
27
old <- cache_info(format = " tabular" )
21
28
# don't activate
29
+ split_path <- function (x ) {
30
+ if (Sys.info()[1 ] == " Windows" ) {
31
+ # not on other platforms as normalizePath messes up /private/var and /var
32
+ x <- normalizePath(x , mustWork = FALSE )
33
+ }
34
+ unlist(strsplit(x , .Platform $ file.sep , fixed = TRUE ))
35
+ }
22
36
23
37
test <- function () {
24
38
local_test_setup()
25
- base <- unlist(strsplit( tempfile(), .Platform $ file.sep , fixed = TRUE ))[2 ]
39
+ base <- split_path( tempfile())[2 ]
26
40
expect_equal(
27
- unlist(strsplit( cache_info(format = " tabular" )$ location , .Platform $ file.sep , fixed = TRUE ) )[2 ],
41
+ split_path( cache_info(format = " tabular" )$ location )[2 ],
28
42
base
29
43
)
30
44
}
0 commit comments