Blame tests/alternative_simple.sh
|
Packit |
1422b7 |
# added 2015-07-22 by Rainer Gerhards
|
|
Packit |
1422b7 |
# This file is part of the liblognorm project, released under ASL 2.0
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
. $srcdir/exec.sh
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
test_def $0 "simple alternative syntax"
|
|
Packit |
1422b7 |
add_rule 'version=2'
|
|
Packit |
1422b7 |
add_rule 'rule=:a %{"type":"alternative", "parser":[{"name":"num", "type":"number"}, {"name":"hex", "type":"hexnumber"}]}% b'
|
|
Packit |
1422b7 |
execute 'a 4711 b'
|
|
Packit |
1422b7 |
assert_output_json_eq '{ "num": "4711" }'
|
|
Packit |
1422b7 |
execute 'a 0x4711 b'
|
|
Packit |
1422b7 |
assert_output_json_eq '{ "hex": "0x4711" }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
cleanup_tmp_files
|