diff --git a/testing/btest/Baseline/language.record-bad-ctor4/out b/testing/btest/Baseline/language.record-bad-ctor4/out new file mode 100644 index 0000000000..7368118fe8 --- /dev/null +++ b/testing/btest/Baseline/language.record-bad-ctor4/out @@ -0,0 +1,3 @@ +### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. +error in <...>/record-bad-ctor4.zeek, line 29: mandatory field "cnt" missing (info2($str=hello)) +error in <...>/record-bad-ctor4.zeek, line 29: mandatory field "a" missing ([$str=hello]) diff --git a/testing/btest/language/record-bad-ctor4.zeek b/testing/btest/language/record-bad-ctor4.zeek new file mode 100644 index 0000000000..2e944c29d2 --- /dev/null +++ b/testing/btest/language/record-bad-ctor4.zeek @@ -0,0 +1,31 @@ +# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1 +# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out + +# Named record constructors should include values for every non-optional, +# non-aggregate field. + +type info1 : record { + str: string; + cnt: count &optional; + a: addr &optional; + + v: vector of bool; + r: record { x: count; }; + s: set[bool]; + t: table[bool] of string; +}; + +type info2 : record { + str: string; + cnt: count; + a: addr; +}; + +event zeek_init() + { + local resp1 = info1($str="hello"); + print resp1; + + local resp2 = info2($str="hello"); + print resp2; + }