Skip to content

Commit 23e56db

Browse files
authored
Better test for parallel output (#2179)
1 parent 13805e8 commit 23e56db

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

tests/testthat/test-parallel-stdout.R

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,28 @@ test_that("stdout/stderr in parallel code", {
55
test_path("test-parallel", "stdout"),
66
reporter = "summary"
77
)))
8-
expect_true("> test-stdout-2.R: This is a message!" %in% out)
9-
expect_true(any(grepl("test-stdout-3.R: [1] 1 2 3", out, fixed = TRUE)))
8+
expect_match(
9+
out,
10+
"> test-stdout-2.R: This is a message!",
11+
fixed = TRUE,
12+
all = FALSE
13+
)
14+
expect_match(out, "test-stdout-3.R: [1] 1 2 3", fixed = TRUE, all = FALSE)
1015

1116
out2 <- capture.output(suppressMessages(testthat::test_local(
1217
test_path("test-parallel", "stdout"),
1318
reporter = "progress"
1419
)))
15-
expect_true("> test-stdout-2.R: This is a message!" %in% out2)
16-
expect_true(any(grepl("test-stdout-3.R: [1] 1 2 3", out2, fixed = TRUE)))
20+
expect_match(
21+
out2,
22+
"> test-stdout-2.R: This is a message!",
23+
fixed = TRUE,
24+
all = FALSE
25+
)
26+
expect_match(
27+
out2,
28+
"test-stdout-3.R: [1] 1 2 3",
29+
fixed = TRUE,
30+
all = FALSE
31+
)
1732
})

0 commit comments

Comments
 (0)