Baseline handling of leading/trailing spaces in to_count/to_int.

Currently `to_count` reports an error for trailing spaces (but not for
leading ones) while `to_int` silently accepts them. This patch adds
baselines capture the current behavior.
This commit is contained in:
Benjamin Bannier 2025-02-18 10:08:57 +01:00
parent 4c4cd5984c
commit 742f17fb15
5 changed files with 12 additions and 1 deletions

View file

@ -1,4 +1,5 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/to_count.zeek, line 8: bad conversion to count (int_to_count(a) and -2)
error in <...>/to_count.zeek, line 20: bad conversion to count (to_count() and )
error in <...>/to_count.zeek, line 22: bad conversion to count (to_count(not a count) and not a count)
error in <...>/to_count.zeek, line 24: bad conversion to count (to_count(206 ) and 206 )
error in <...>/to_count.zeek, line 25: bad conversion to count (to_count(not a count) and not a count)

View file

@ -6,6 +6,8 @@
7
0
18446744073709551611
205
0
0
123
9223372036854775808 and 9223372036854775808 are the same

View file

@ -3,6 +3,8 @@
-1
4294967296
0
205
206
3
4
-3

View file

@ -19,6 +19,9 @@ event zeek_init()
print to_count("7");
print to_count("");
print to_count("-5");
# We automatically trim leading, but not trailing whitespace.
print to_count(" 205"); # Okay.
print to_count("206 "); # Error.
print to_count("not a count");
local e: port = 123/tcp;

View file

@ -8,6 +8,9 @@ event zeek_init()
print to_int("-1");
print to_int("4294967296");
print to_int("not an int");
# We automatically trim leading, but not trailing whitespace.
print to_int(" 205"); # Okay.
print to_int("206 "); # Error.
local a: double = 3.14;
print double_to_int(a);