1
1
test_that(" GitHub Actions functionality works" , {
2
- # imitate being on GHA whether or not we are
3
2
withr :: local_envvar(list (GITHUB_ACTIONS = " true" ))
4
3
withr :: local_options(lintr.rstudio_source_markers = FALSE )
5
4
tmp <- withr :: local_tempfile(lines = " x <- 1:nrow(y)" )
@@ -9,7 +8,6 @@ test_that("GitHub Actions functionality works", {
9
8
})
10
9
11
10
test_that(" GitHub Actions functionality works in a subdirectory" , {
12
- # imitate being on GHA whether or not we are
13
11
pkg_path <- test_path(" dummy_packages" , " assignmentLinter" )
14
12
withr :: local_envvar(list (GITHUB_ACTIONS = " true" ))
15
13
withr :: local_options(lintr.rstudio_source_markers = FALSE , lintr.github_annotation_project_dir = pkg_path )
@@ -26,14 +24,31 @@ test_that("GitHub Actions functionality works in a subdirectory", {
26
24
)
27
25
})
28
26
29
- test_that(" GitHub Actions - linting on error works" , {
30
- # imitate being on GHA whether or not we are
31
- withr :: local_envvar(list (GITHUB_ACTIONS = " true" , LINTR_ERROR_ON_LINT = " true" ))
32
- withr :: local_options(lintr.rstudio_source_markers = FALSE )
33
- tmp <- withr :: local_tempfile(lines = " x <- 1:nrow(y)" )
27
+ patrick :: with_parameters_test_that(
28
+ " GitHub Actions - error on lint works" ,
29
+ {
30
+ withr :: local_envvar(list (GITHUB_ACTIONS = " true" , LINTR_ERROR_ON_LINT = env_var_value ))
31
+ withr :: local_options(lintr.rstudio_source_markers = FALSE )
32
+ tmp <- withr :: local_tempfile(lines = " x <- 1:nrow(y)" )
34
33
35
- l <- lint(tmp )
34
+ l <- lint(tmp )
36
35
37
- local_mocked_bindings(quit = function (... ) cat(" Tried to quit.\n " ))
38
- expect_output(print(l ), " ::warning file" , fixed = TRUE )
39
- })
36
+ local_mocked_bindings(quit = function (... ) cat(" Tried to quit.\n " ))
37
+ expect_output(print(l ), " ::warning file" , fixed = TRUE )
38
+ },
39
+ env_var_value = list (" T" , " true" )
40
+ )
41
+
42
+ patrick :: with_parameters_test_that(
43
+ " GitHub Actions - env var for error on lint is converted to logical" ,
44
+ {
45
+ withr :: local_envvar(list (GITHUB_ACTIONS = " true" , LINTR_ERROR_ON_LINT = env_var_value ))
46
+ withr :: local_options(lintr.rstudio_source_markers = FALSE )
47
+ tmp <- withr :: local_tempfile(lines = " x <- 1:nrow(y)" )
48
+
49
+ l <- lint(tmp )
50
+
51
+ expect_output(print(l ), " ::warning file" , fixed = TRUE )
52
+ },
53
+ env_var_value = list (" " , " F" , NA , NULL )
54
+ )
0 commit comments