You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tf<-function() cat('my output') # test function
expect_output(tf(), 'output') # passes, as expected
expect_output(tf(), 'xxx') # error, as expected# Error: tf() does not match 'xxx'. Actual value: "my output"
expect_output(tf(), NA) # passes. Expected error.
expect_output(tf()) # fails. Expected pass. # Error in identical(regexp, NA) : # argument "regexp" missing, without default value
packageVersion('testthat')
# [1] ‘0.11.0.9000’
In the last two expectations:
NA means expect no output, however, it passes.
omitted regexp means expect some output, however it fails.
The text was updated successfully, but these errors were encountered:
Hmmm, the problem with expect_output(tf(), NA) is that expect_output() always prints the input, so as far as I can tell there's no case in which code won't create output.
Hmmm, the problem with expect_output(tf(), NA) is that expect_output() always prints the input, so as far as I can tell there's no case in which code won't create output.
I'm thinking the next version of testthat will be 1.0.0 so it's probably ok to change this behaviour to force the user to print() the object if they want to inspect the output.
In the last two expectations:
NA
means expect no output, however, it passes.regexp
means expect some output, however it fails.The text was updated successfully, but these errors were encountered: