mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Improve error message of index assignment expression failures
This commit is contained in:
parent
802b4f876e
commit
a7ba44089b
3 changed files with 62 additions and 2 deletions
|
@ -0,0 +1 @@
|
|||
internal error in /Users/jon/projects/bro/bro/scripts/base/utils/queue.bro, line 152: vector index assignment failed for invalid type 'myrec', value: [a=T, b=hi, c=<uninitialized>] (Queue::ret[Queue::j])
|
31
testing/btest/language/index-assignment-invalid.bro
Normal file
31
testing/btest/language/index-assignment-invalid.bro
Normal file
|
@ -0,0 +1,31 @@
|
|||
# @TEST-EXEC-FAIL: bro -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||
|
||||
@load base/utils/queue
|
||||
|
||||
global q: Queue::Queue = Queue::init();
|
||||
|
||||
type myrec: record {
|
||||
a: bool &default=T;
|
||||
b: string &default="hi";
|
||||
c: string &optional;
|
||||
};
|
||||
|
||||
function foo(mr: myrec)
|
||||
{
|
||||
print mr$a;
|
||||
print mr$c;
|
||||
print mr$b;
|
||||
}
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
Queue::put(q, "hello");
|
||||
Queue::put(q, "goodbye");
|
||||
Queue::put(q, "test");
|
||||
Queue::put(q, myrec());
|
||||
|
||||
local rval: vector of string = vector();
|
||||
Queue::get_vector(q, rval);
|
||||
print rval;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue