File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ Imports:
44
44
stats,
45
45
tibble,
46
46
vctrs (>= 0.4.1),
47
- withr (>= 2.0 .0)
47
+ withr (>= 2.5 .0)
48
48
Suggests:
49
49
covr,
50
50
dplyr,
Original file line number Diff line number Diff line change @@ -36,20 +36,16 @@ get_n_data.frame <- function(f) {
36
36
}
37
37
38
38
test_that(" `get_n_*() detects number of calls properly" , {
39
- withr :: local_file(" tmp.R" )
40
- writeLines(
41
- c(
42
- ' stop("foo!")' ,
43
- ' warning("bar!")' ,
44
- " data.frame(x = 1)" ,
45
- " base::data.frame(x = 1)" # this is not counted
46
- ),
47
- " tmp.R"
48
- )
49
-
50
- expect_equal(get_n_stop(" tmp.R" ), 1 )
51
- expect_equal(get_n_warning(" tmp.R" ), 1 )
52
- expect_equal(get_n_data.frame(" tmp.R" ), 1 )
39
+ tmp <- withr :: local_tempfile(lines = c(
40
+ ' stop("foo!")' ,
41
+ ' warning("bar!")' ,
42
+ " data.frame(x = 1)" ,
43
+ " base::data.frame(x = 1)" # this is not counted
44
+ ))
45
+
46
+ expect_equal(get_n_stop(tmp ), 1 )
47
+ expect_equal(get_n_warning(tmp ), 1 )
48
+ expect_equal(get_n_data.frame(tmp ), 1 )
53
49
})
54
50
55
51
# Pattern is needed filter out files such as ggplot2.rdb, which is created when running covr::package_coverage()
You can’t perform that action at this time.
0 commit comments