zeek/testing/btest/language/record-bad-ctor2.bro
Jon Siwek aee708c703 Change record ctors to only allow record-field-assignment expressions.
Previously, any expression that evaluates to a record may have been used
in a record ctor's expression list.  This didn't work in all cases,
doesn't provide any unique functionality that can't be done otherwise,
and is possibly a path to introducing subtle scripting errors.

BIT-1192 #closed
2014-05-19 15:50:00 -05:00

16 lines
448 B
Text

# @TEST-EXEC-FAIL: bro -b %INPUT >out 2>&1
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
# Record ctor's expression list shouldn't accept "expressions that
# eval in to record". The expression list should only be comprised of
# record-field-assignment expressions.
type myrec: record {
cmd: string;
stdin: string &default="";
read_files: string &optional;
};
local bad = myrec([$cmd="echo hi"]);
print bad;