Skip to content

Commit 8221f82

Browse files
committed
Better test for parallel output
1 parent fa29578 commit 8221f82

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/testthat/test-parallel-stdout.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ 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+
out <- paste(out, collapse = "\n")
9+
expect_match(out, "> test-stdout-2.R: This is a message!", fixed = TRUE)
10+
expect_match(out, "test-stdout-3.R: [1] 1 2 3", fixed = TRUE)
1011

1112
out2 <- capture.output(suppressMessages(testthat::test_local(
1213
test_path("test-parallel", "stdout"),
1314
reporter = "progress"
1415
)))
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)))
16+
out2 <- paste(out2, collapse = "\n")
17+
expect_match(out2, "> test-stdout-2.R: This is a message!", fixed = TRUE)
18+
expect_match(out2, "test-stdout-3.R: [1] 1 2 3", fixed = TRUE)
1719
})

0 commit comments

Comments
 (0)