mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Fix check_for_unused_event_handlers option.
The format string given to the reporter warning call wasn't printing the handler names. Also changed it so that each warning message has the full context of the warning.
This commit is contained in:
parent
59e5fc5633
commit
521f54c4f0
3 changed files with 10 additions and 2 deletions
|
@ -931,9 +931,8 @@ int main(int argc, char** argv)
|
|||
|
||||
if ( dead_handlers->length() > 0 && check_for_unused_event_handlers )
|
||||
{
|
||||
reporter->Warning("event handlers never invoked:");
|
||||
for ( int i = 0; i < dead_handlers->length(); ++i )
|
||||
reporter->Warning("\t", (*dead_handlers)[i]);
|
||||
reporter->Warning("event handler never invoked: %s", (*dead_handlers)[i]);
|
||||
}
|
||||
|
||||
delete dead_handlers;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
warning in <params>, line 1: event handler never invoked: this_is_never_used
|
8
testing/btest/core/check-unused-event-handlers.test
Normal file
8
testing/btest/core/check-unused-event-handlers.test
Normal file
|
@ -0,0 +1,8 @@
|
|||
# This test should print a warning that the event handler is never invoked.
|
||||
# @TEST-EXEC: bro -b %INPUT check_for_unused_event_handlers=T
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
event this_is_never_used()
|
||||
{
|
||||
print "not even once";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue