Add table_keys function

This commit is contained in:
AmazingPP 2022-07-09 01:11:31 +08:00
parent cb71b15eab
commit ba552ceeaf
5 changed files with 73 additions and 21 deletions

View file

@ -0,0 +1,5 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
{
http,
https
}

View file

@ -0,0 +1,15 @@
#
# @TEST-EXEC: zeek -b %INPUT > out
# @TEST-EXEC: btest-diff out
event zeek_init()
{
local t = table(
["http"] = "http://www.google.com/",
["https"] = "https://www.google.com/"
);
local v: set[string] = table_keys(t);
print v;
}

View file

@ -5,14 +5,14 @@
event zeek_init()
{
local t = table(
["web"] = { [80/tcp, "http"], [443/tcp, "https"] },
["login"] = { [21/tcp, "ftp"], [23/tcp, "telnet"] }
["web"] = { [80/tcp, "http"], [443/tcp, "https"] },
["login"] = { [21/tcp, "ftp"], [23/tcp, "telnet"] }
);
local v: vector of set[port, string] = table_values(t);
local v: vector of set[port, string] = table_values(t);
for ( i in v )
{
print v[i];
}
{
print v[i];
}
}