mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
zeek-setup: Load scrips before running unit tests
It is currently not possible to call a->Conn()->GetVal() or construct a zeek/file_analysis/File object from within doctests, as these quickly reference the unpopulated zeek::id namespace to construct Val objects of various types, making it hard write basic tests without completely re-organizing. Move running of the unit tests after parsing the scripts, so it is possible for some basic exercising of File objects within tests.
This commit is contained in:
parent
71f487bd20
commit
9f8eb682b1
2 changed files with 13 additions and 17 deletions
|
@ -535,9 +535,6 @@ TEST_CASE("construction")
|
|||
CHECK_EQ(s7.Len(), 6);
|
||||
CHECK_EQ(s7.Bytes(), text2);
|
||||
|
||||
// Construct a temporary reporter object for the next two tests
|
||||
zeek::reporter = new zeek::Reporter(false);
|
||||
|
||||
zeek::byte_vec text3 = new u_char[7];
|
||||
memcpy(text3, text.c_str(), 7);
|
||||
zeek::String s8{false, text3, 6};
|
||||
|
@ -549,8 +546,6 @@ TEST_CASE("construction")
|
|||
zeek::String s9{false, text4, 6};
|
||||
CHECK_EQ(std::string(s9.CheckString()), "<string-with-NUL>");
|
||||
|
||||
delete zeek::reporter;
|
||||
|
||||
zeek::byte_vec text5 = (zeek::byte_vec)malloc(7);
|
||||
memcpy(text5, text.c_str(), 7);
|
||||
zeek::String s10{true, text5, 6};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue