diff --git a/tests/testthat/reporters/check.txt b/tests/testthat/reporters/check.txt index c2dc2fda0..a000f69e1 100644 --- a/tests/testthat/reporters/check.txt +++ b/tests/testthat/reporters/check.txt @@ -20,15 +20,8 @@ FALSE isn't true. stop 1: stop("stop") at reporters/tests.R:28 -6. Error: Error:3 (@tests.R#36) ------------------------------------------------ -! -1: f() at reporters/tests.R:36 -2: g() at reporters/tests.R:32 -3: h() at reporters/tests.R:33 -4: stop("!") at reporters/tests.R:34 - testthat results ================================================================ -OK: 5 SKIPPED: 2 FAILED: 6 +OK: 7 SKIPPED: 2 FAILED: 6 1. Failure: Failure:1 (@tests.R#8) 2. Failure: Failure:2a (@tests.R#12) 3. Failure: Failure:2b (@tests.R#15) diff --git a/tests/testthat/reporters/minimal.txt b/tests/testthat/reporters/minimal.txt index 7635dc98a..7613be39f 100644 --- a/tests/testthat/reporters/minimal.txt +++ b/tests/testthat/reporters/minimal.txt @@ -1 +1 @@ -.FFFF.EESSWWW +.FFFF.ESSWWWF diff --git a/tests/testthat/reporters/rstudio.txt b/tests/testthat/reporters/rstudio.txt index 99c3907da..c4360df49 100644 --- a/tests/testthat/reporters/rstudio.txt +++ b/tests/testthat/reporters/rstudio.txt @@ -3,7 +3,6 @@ reporters/tests.R#12:1 [failure] Failure:2a. Failure has been forced reporters/tests.R#15:1 [failure] Failure:2b. FALSE isn't true. reporters/tests.R#20:1 [failure] Failure:loop. `i` not equal to 2. reporters/tests.R#28:1 [error] Error:1. stop -reporters/tests.R#36:1 [error] Error:3. ! reporters/tests.R#42:1 [skip] Skip:1. skip reporters/tests.R#47:1 [skip] Skip:2. skip reporters/tests.R#53:1 [warning] Warning:1. abc diff --git a/tests/testthat/reporters/summary.txt b/tests/testthat/reporters/summary.txt index 806da3b6c..53debb9c6 100644 --- a/tests/testthat/reporters/summary.txt +++ b/tests/testthat/reporters/summary.txt @@ -1,7 +1,8 @@ Expectations: .1234. -Errors: 56 +Errors: 5 Skips: SS Warnings: WWW +Promises: 7 Skipped -------------------------------------------------------------------- 1. Skip:1 (@tests.R#42) - skip @@ -40,9 +41,20 @@ stop 6. Error: Error:3 (@tests.R#36) ------------------------------------------------ ! -1: f() at reporters/tests.R:36 -2: g() at reporters/tests.R:32 -3: h() at reporters/tests.R:33 -4: stop("!") at reporters/tests.R:34 +1: expect_message(f(), NA) at reporters/tests.R:36 +2: evaluate_promise(object, capture_warnings = FALSE) at /home/muelleki/git/R/testthat/R/expect-output.R:145 +3: with_sink(temp, withCallingHandlers(withVisible(code), warning = handle_warning, + message = handle_message)) at /home/muelleki/git/R/testthat/R/evaluate-promise.R:56 +4: withCallingHandlers(withVisible(code), warning = handle_warning, message = handle_message) at /home/muelleki/git/R/testthat/R/evaluate-promise.R:87 +5: withVisible(code) +6: f() +7: g() at reporters/tests.R:32 +8: h() at reporters/tests.R:33 +9: stop("!") at reporters/tests.R:34 + +7. Failure: Promises:1 (@tests.R#64) ------------------------------------------- +expect_false(FALSE) produced output. +. + DONE ======================================================================= diff --git a/tests/testthat/reporters/tap.txt b/tests/testthat/reporters/tap.txt index f785642b5..e2ff10f02 100644 --- a/tests/testthat/reporters/tap.txt +++ b/tests/testthat/reporters/tap.txt @@ -1,4 +1,4 @@ -1..13 +1..15 # Context Expectations ok 1 Success not ok 2 Failure:1 @@ -22,10 +22,16 @@ not ok 7 Error:1 1: stop("stop") at reporters/tests.R:28 not ok 8 Error:3 ! - 1: f() at reporters/tests.R:36 - 2: g() at reporters/tests.R:32 - 3: h() at reporters/tests.R:33 - 4: stop("!") at reporters/tests.R:34 + 1: expect_message(f(), NA) at reporters/tests.R:36 + 2: evaluate_promise(object, capture_warnings = FALSE) at /home/muelleki/git/R/testthat/R/expect-output.R:145 + 3: with_sink(temp, withCallingHandlers(withVisible(code), warning = handle_warning, + message = handle_message)) at /home/muelleki/git/R/testthat/R/evaluate-promise.R:56 + 4: withCallingHandlers(withVisible(code), warning = handle_warning, message = handle_message) at /home/muelleki/git/R/testthat/R/evaluate-promise.R:87 + 5: withVisible(code) + 6: f() + 7: g() at reporters/tests.R:32 + 8: h() at reporters/tests.R:33 + 9: stop("!") at reporters/tests.R:34 # Context Skips ok 9 # SKIP skip ok 10 # SKIP skip @@ -33,3 +39,6 @@ ok 10 # SKIP skip ok 11 # WARNING abc ok 12 # WARNING def ok 13 # WARNING ghi +# Context Promises +ok 14 Promises:1 +ok 15 Promises:1 diff --git a/tests/testthat/reporters/teamcity.txt b/tests/testthat/reporters/teamcity.txt index 31d3dea6e..626de678e 100644 --- a/tests/testthat/reporters/teamcity.txt +++ b/tests/testthat/reporters/teamcity.txt @@ -41,9 +41,6 @@ ##teamcity[testSuiteFinished name='Error:1'] ##teamcity[testSuiteStarted name='Error:3'] -##teamcity[testStarted name='expectation 1'] -##teamcity[testFailed name='expectation 1' message='!' details='1: f() at reporters/tests.R:36|n2: g() at reporters/tests.R:32|n3: h() at reporters/tests.R:33|n4: stop("!") at reporters/tests.R:34'] -##teamcity[testFinished name='expectation 1'] ##teamcity[testSuiteFinished name='Error:3'] ##teamcity[testSuiteFinished name='Errors'] @@ -77,3 +74,13 @@ ##teamcity[testSuiteFinished name='Warnings'] +##teamcity[testSuiteStarted name='Promises'] +##teamcity[testSuiteStarted name='Promises:1'] +##teamcity[testStarted name='expectation 2'] +##teamcity[testFailed name='expectation 2' message='expect_false(FALSE) produced output.' details='##teamcity|[testStarted name=|'expectation 1|'|]\n##teamcity|[testFinished name=|'expectation 1|'|]'] +##teamcity[testFinished name='expectation 2'] +##teamcity[testSuiteFinished name='Promises:1'] + +##teamcity[testSuiteFinished name='Promises'] + + diff --git a/tests/testthat/reporters/tests.R b/tests/testthat/reporters/tests.R index 17b25f91c..22f742f79 100644 --- a/tests/testthat/reporters/tests.R +++ b/tests/testthat/reporters/tests.R @@ -33,7 +33,7 @@ test_that("Error:3", { g <- function() {h()} h <- function() {stop("!")} - f() + expect_message(f(), NA) }) context("Skips") @@ -57,3 +57,9 @@ test_that("Warning:2", { warning("def") warning("ghi") }) + +context("Promises") + +test_that("Promises:1", { + expect_output(expect_false(FALSE), NA) +})