mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 11:08:20 +00:00
BTests for any/vector-of-any fixes
This commit is contained in:
parent
d70a0fae85
commit
8e5dac3900
3 changed files with 50 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
error in <...>/vector-any-append.zeek, line 61: incompatible vector element assignment (v7 += v5 and [a, -3])
|
|
@ -1,2 +1,7 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
[0, 1, 2, 3]
|
||||
[4, 0, 1, 2, 3]
|
||||
[1, 2, 3, [4, 5]], 4, count, count, vector of count
|
||||
[[r=r], [r=r], [s=s], [s=s]]
|
||||
[a, -3]
|
||||
[]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
|
||||
|
||||
function assign(v: vector of any)
|
||||
{
|
||||
|
@ -11,6 +12,17 @@ function append(v: vector of any)
|
|||
v += |v|;
|
||||
}
|
||||
|
||||
type R: record { r: string &default="r"; };
|
||||
type S: record { s: string &default="s"; };
|
||||
|
||||
global q: vector of any;
|
||||
|
||||
function keep_this_two_ways(r: any)
|
||||
{
|
||||
q += r;
|
||||
q[|q|] = r;
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local v: vector of count;
|
||||
|
@ -19,4 +31,35 @@ event zeek_init()
|
|||
append(v);
|
||||
append(v);
|
||||
print v;
|
||||
|
||||
local v2: vector of any;
|
||||
v2 += |v|;
|
||||
v2 += v;
|
||||
print v2;
|
||||
|
||||
local v3: vector of any;
|
||||
local v4: any = vector(4, 5);
|
||||
|
||||
v3 += 1;
|
||||
v3 += vector(2, 3);
|
||||
v3 += v4;
|
||||
|
||||
print v3, |v3|, type_name(v3[0]), type_name(v3[1]), type_name(v3[3]);
|
||||
|
||||
keep_this_two_ways(R());
|
||||
keep_this_two_ways(S());
|
||||
print q;
|
||||
|
||||
local v5: vector of any;
|
||||
local v6: vector of any;
|
||||
local v7: vector of count;
|
||||
|
||||
v5 += "a";
|
||||
v5 += -3;
|
||||
|
||||
v6 += v5;
|
||||
v7 += v5;
|
||||
|
||||
print v6;
|
||||
print v7;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue