Blame tests/field_cee-syslog_v1.sh

Packit 1422b7
# added 2015-03-01 by Rainer Gerhards
Packit 1422b7
# This file is part of the liblognorm project, released under ASL 2.0
Packit 1422b7
. $srcdir/exec.sh
Packit 1422b7
Packit 1422b7
test_def $0 "JSON field"
Packit 1422b7
add_rule 'rule=:%field:cee-syslog%'
Packit 1422b7
Packit 1422b7
execute '@cee:{"f1": "1", "f2": 2}'
Packit 1422b7
assert_output_json_eq '{ "field": { "f1": "1", "f2": 2 } }'
Packit 1422b7
Packit 1422b7
execute '@cee:{"f1": "1", "f2": 2} ' # note the trailing space
Packit 1422b7
assert_output_json_eq '{ "field": { "f1": "1", "f2": 2 } }'
Packit 1422b7
Packit 1422b7
execute '@cee: {"f1": "1", "f2": 2}'
Packit 1422b7
assert_output_json_eq '{ "field": { "f1": "1", "f2": 2 } }'
Packit 1422b7
Packit 1422b7
execute '@cee:     {"f1": "1", "f2": 2}'
Packit 1422b7
assert_output_json_eq '{ "field": { "f1": "1", "f2": 2 } }'
Packit 1422b7
Packit 1422b7
#
Packit 1422b7
# Things that MUST NOT work
Packit 1422b7
#
Packit 1422b7
execute '@cee: {"f1": "1", "f2": 2} data'
Packit 1422b7
assert_output_json_eq '{ "originalmsg": "@cee: {\"f1\": \"1\", \"f2\": 2} data", "unparsed-data": "@cee: {\"f1\": \"1\", \"f2\": 2} data" }'
Packit 1422b7
Packit 1422b7
Packit 1422b7
cleanup_tmp_files
Packit 1422b7