Skip to content

Commit

Permalink
testbench: add test for cisco-interface-spec parser at end of line
Browse files Browse the repository at this point in the history
see also #229
  • Loading branch information
rgerhards committed Jun 26, 2018
1 parent 268da40 commit 7e3ecbf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ TESTS_SHELLSCRIPTS += \
field_suffixed.sh \
field_suffixed_with_invalid_ruledef.sh \
field_cisco-interface-spec.sh \
field_cisco-interface-spec-at-EOL.sh \
field_float_with_invalid_ruledef.sh \
very_long_logline.sh

Expand Down
15 changes: 15 additions & 0 deletions tests/field_cisco-interface-spec-at-EOL.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# added 2015-04-13 by Rainer Gerhards
# This file is part of the liblognorm project, released under ASL 2.0
. $srcdir/exec.sh

test_def $0 "cisco-interface-spec-at-EOL syntax"
add_rule 'version=2'
add_rule 'rule=:begin %field:cisco-interface-spec%%r:rest%'

execute 'begin outside:192.0.2.1/50349 end'
assert_output_json_eq '{ "r": " end", "field": { "interface": "outside", "ip": "192.0.2.1", "port": "50349" } }'

execute 'begin outside:192.0.2.1/50349'
assert_output_json_eq '{ "r": "", "field": { "interface": "outside", "ip": "192.0.2.1", "port": "50349" } }'

cleanup_tmp_files

0 comments on commit 7e3ecbf

Please sign in to comment.