mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00

Copying an &ordered table or set would result in a copy that is not ordered. This seems rather surprising behavior, so propagate the &ordered attribute. Closes #2793
32 lines
521 B
Text
32 lines
521 B
Text
# @TEST-EXEC: zeek -b %INPUT >out
|
|
# @TEST-EXEC: btest-diff out
|
|
# @TEST-EXEC: btest-diff .stderr
|
|
|
|
global sset: set[string];
|
|
global ordered_sset: set[string] &ordered;
|
|
|
|
event zeek_init()
|
|
{
|
|
local i = 0;
|
|
while ( ++i <= 5 )
|
|
{
|
|
add sset[cat(i)];
|
|
add ordered_sset[cat(i)];
|
|
}
|
|
|
|
print "sset";
|
|
for ( s in sset )
|
|
print s;
|
|
|
|
print "copy(sset)";
|
|
for ( s in copy(sset) )
|
|
print s;
|
|
|
|
print "ordered_sset";
|
|
for ( s in ordered_sset )
|
|
print s;
|
|
|
|
print "copy(ordered_sset)";
|
|
for ( s in copy(ordered_sset) )
|
|
print s;
|
|
}
|