zeek/testing/btest/doc/record-add.bro
Jon Siwek d69c3edf21 Fixes for more doc mode corner cases caused by type cloning.
"shallow" copying has to be done for any type that can contain
record types in order to accommodate record redefs that add fields.
2011-05-17 15:03:40 -05:00

36 lines
892 B
Text

# @TEST-EXEC: bro --doc-scripts %INPUT
# When in doc mode, bro will clone declared types (see add_type() in Var.cc)
# in order to keep track of the identifier name associated with the new type.
# This test makes sure that the cloning is done in a way that's compatible
# with adding fields to a record type -- we want to be sure that cloning
# a type that contains record types will correctly see field additions to
# those contained-records.
type my_record: record {
field1: bool;
field2: string;
};
type super_record: record {
rec: my_record;
};
type my_table: table[count] of my_record;
type my_vector: vector of my_record;
redef record my_record += {
field3: count &optional;
};
global a: my_record;
global b: super_record;
global c: my_table;
global d: my_vector;
function test_func()
{
a?$field3;
b$rec?$field3;
c[0]$field3;
d[0]$field3;
}