-
Notifications
You must be signed in to change notification settings - Fork 342
Open
Description
I'm writing two kinds of test: (1) that multiple messages are produced; (2) that exactly one message is produced.
It doesn't seem to be possible at the moment.
expect_message(message('hi')) # ok
expect_message(message('hi'), 'hi') # ok
expect_no_message(expect_message(message('hi'))) # ostensibly ok
expect_no_message(expect_message(message('hi'), 'hi')) # ostensibly ok
# now some cases where the behavior is less as expected
# might expect the 'bye' message to result here
expect_message({ message('hi'); message('bye') }, 'hi') # no output
expect_message(expect_message({ message('hi'); message('bye') }))
# Error: Expected `expect_message(...)` to produce messages.
# expectation: the 'hi' message is caught while the 'bye' message bubbles up
expect_message(expect_message({ message('hi'); message('bye') }, 'hi'))
# Error: Expected `expect_message(...)` to produce messages.
expect_no_message(expect_message({ message('hi'); message('bye') }, 'hi'))
# passes, but might expect the uncaught 'bye' to failI think it mostly comes down to this example: expect_message({ message('hi'); message('bye') }, 'hi') # no output.
The same happens with other signal classes: expect_warning({ warning('hi'); warning('bye') }, 'hi'). But I thought I remembered needing nested expect_warning() in the past?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels