|
Packit |
1422b7 |
# added 2016-12-21 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 |
test_def $0 "using names with literal"
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
add_rule 'version=2'
|
|
Packit |
1422b7 |
add_rule 'rule=:%{"type":"literal", "text":"a", "name":"var"}%'
|
|
Packit |
1422b7 |
execute 'a'
|
|
Packit |
1422b7 |
assert_output_json_eq '{ "var": "a" }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
reset_rules
|
|
Packit |
1422b7 |
add_rule 'version=2'
|
|
Packit |
1422b7 |
add_rule 'rule=:Test %{"type":"literal", "text":"a", "name":"var"}%'
|
|
Packit |
1422b7 |
execute 'Test a'
|
|
Packit |
1422b7 |
assert_output_json_eq '{ "var": "a" }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
reset_rules
|
|
Packit |
1422b7 |
add_rule 'version=2'
|
|
Packit |
1422b7 |
add_rule 'rule=:Test %{"type":"literal", "text":"a", "name":"var"}% End'
|
|
Packit |
1422b7 |
execute 'Test a End'
|
|
Packit |
1422b7 |
assert_output_json_eq '{ "var": "a" }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
reset_rules
|
|
Packit |
1422b7 |
add_rule 'version=2'
|
|
Packit |
1422b7 |
add_rule 'rule=:a %[{"name":"num", "type":"number"}, {"name":"colon", "type":"literal", "text":":"}, {"name":"hex", "type":"hexnumber"}]% b'
|
|
Packit |
1422b7 |
execute 'a 4711:0x4712 b'
|
|
Packit |
1422b7 |
assert_output_json_eq '{ "hex": "0x4712", "colon": ":", "num": "4711" }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
cleanup_tmp_files
|