Skip to content

Commit

Permalink
Test error output in expect_message()
Browse files Browse the repository at this point in the history
with update of golden files to show the problem
  • Loading branch information
Kirill Müller committed Mar 3, 2016
1 parent 06f1a36 commit fe2ea0e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 deletions.
7 changes: 0 additions & 7 deletions tests/testthat/reporters/check.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ 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
1. Failure: Failure:1 (@tests.R#8)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/reporters/minimal.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.FFFF.EESSWWW
.FFFF.ESSWWW
1 change: 0 additions & 1 deletion tests/testthat/reporters/rstudio.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions tests/testthat/reporters/summary.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Expectations: .1234.
Errors: 56
Errors: 5
Skips: SS
Warnings: WWW

Expand Down Expand Up @@ -40,9 +40,15 @@ 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

DONE =======================================================================
14 changes: 10 additions & 4 deletions tests/testthat/reporters/tap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/reporters/teamcity.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/reporters/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test_that("Error:3", {
g <- function() {h()}
h <- function() {stop("!")}

f()
expect_message(f(), NA)
})

context("Skips")
Expand Down

0 comments on commit fe2ea0e

Please sign in to comment.