zeek/testing/btest/language/module.zeek
Robin Sommer 789cb376fd GH-239: Rename bro to zeek, bro-config to zeek-config, and bro-path-dev to zeek-path-dev.
This also installs symlinks from "zeek" and "bro-config" to a wrapper
script that prints a deprecation warning.

The btests pass, but this is still WIP. broctl renaming is still
missing.

#239
2019-05-01 21:43:45 +00:00

41 lines
916 B
Text

# @TEST-EXEC: zeek -b %INPUT secondtestfile >out
# @TEST-EXEC: btest-diff out
# In this source file, we define a module and export some objects
module thisisatest;
export {
global test_case: function(msg: string, expect: bool);
global testevent: event(msg: string);
global num: count = 123;
const daysperyear: count = 365;
}
function test_case(msg: string, expect: bool)
{
print fmt("%s (%s)", msg, expect ? "PASS" : "FAIL");
}
event testevent(msg: string)
{
test_case( "event", T );
}
# @TEST-START-FILE secondtestfile
# In this source file, we try to access each exported object from the module
event zeek_init()
{
thisisatest::test_case( "function", T );
thisisatest::test_case( "global variable", thisisatest::num == 123 );
thisisatest::test_case( "const", thisisatest::daysperyear == 365 );
event thisisatest::testevent( "foo" );
}
# @TEST-END-FILE