Skip to content

Commit b661246

Browse files
TESTS: be agile to required test arguments
1 parent e88a93b commit b661246

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: future.tests
22
Title: Test Suite for 'Future API' Backends
3-
Version: 0.9.0-9005
3+
Version: 0.9.0-9006
44
Authors@R: c(
55
person("Henrik", "Bengtsson", role = c("aut", "cre", "cph"), email = "[email protected]"),
66
person(family = "The R Consortium", comment = "Project was awarded an Infrastructure Steering Committee (ISC) grant in 2017", role = "fnd"))

inst/testme/test-Test-class.R

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
library(future.tests)
55
library(future)
66

7-
lazy <- FALSE
8-
global <- TRUE
9-
stdout <- TRUE
10-
value <- TRUE
11-
recursive <- FALSE
12-
137
tests <- load_tests()
148
message("Number of tests: ", length(tests))
159

@@ -19,7 +13,14 @@ print(df_tests)
1913
message("Run first three tests ...")
2014

2115
library(future)
22-
results <- run_tests(head(tests, 3L))
16+
17+
tests_3 <- head(tests, 3L)
18+
19+
## Create default values
20+
defaults <- lapply(tests_3, FUN = function(test) test[["args"]])
21+
defaults <- do.call(c, unname(defaults))
22+
defaults <- lapply(defaults, FUN = function(arg) arg[[1]])
23+
results <- run_tests(tests_3, defaults = defaults)
2324
print(results)
2425

2526
df_results <- do.call(rbind, results)
@@ -34,9 +35,6 @@ tests <- tests[seq(from = 1L, to = length(tests), length.out = 5L)]
3435

3536
library(future)
3637

37-
value <- TRUE
38-
recursive <- FALSE
39-
4038
ntests <- length(tests)
4139

4240
add_test_plan(plan(sequential))

inst/testme/test-one-test.R

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
library(future.tests)
22
library(future)
33

4-
lazy <- FALSE
5-
global <- TRUE
6-
stdout <- TRUE
7-
value <- TRUE
8-
recursive <- FALSE
9-
104
tests <- load_tests()
115

126
test <- tests[[1]]
137
print(test)
148

15-
result <- run_test(test)
9+
## Create default values
10+
defaults <- test[["args"]]
11+
defaults <- lapply(defaults, FUN = function(arg) arg[[1]])
12+
13+
result <- run_test(test, defaults = defaults)
1614
print(result)

0 commit comments

Comments
 (0)