zeek/testing/btest/bifs/enable_raw_output.test

23 lines
572 B
Text

# Files which enable raw output via the BiF shouldn't interpret NUL characters
# in strings that are `print`ed to it.
# @TEST-EXEC: bro -b %INPUT
# @TEST-EXEC: tr '\000' 'X' <myfile >output
# @TEST-EXEC: btest-diff output
# @TEST-EXEC: cmp myfile hookfile
event zeek_init()
{
local myfile: file;
myfile = open("myfile");
enable_raw_output(myfile);
print myfile, "hello\x00world", "hi";
close(myfile);
}
event print_hook(f: file, s: string)
{
local hookfile = open("hookfile");
write_file(hookfile, s);
close(hookfile);
}