mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00
Return an error if redef'ing a variable without redef attribute
This commit is contained in:
parent
86c316ddfc
commit
00e111135b
4 changed files with 39 additions and 0 deletions
29
testing/btest/language/redef-global-function.zeek
Normal file
29
testing/btest/language/redef-global-function.zeek
Normal file
|
@ -0,0 +1,29 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT -e "redef funcb = func2;" > out
|
||||
# @TEST-EXEC-FAIL: zeek -b %INPUT -e "redef funca = func2;" >> out
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
|
||||
|
||||
export {
|
||||
global func1: function();
|
||||
global func2: function();
|
||||
}
|
||||
|
||||
function func1()
|
||||
{
|
||||
print "func1()";
|
||||
}
|
||||
|
||||
function func2()
|
||||
{
|
||||
print "func2()";
|
||||
}
|
||||
|
||||
export {
|
||||
global funca = func1;
|
||||
global funcb = func1 &redef;
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
funcb();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue