Skip to content

incorrect behaviour of expect_output()? #323

Closed
@famuvie

Description

@famuvie
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions