Blame tests/repeat_while_alternative.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 "repeat syntax with alternative terminators"
Packit 1422b7
add_rule 'version=2'
Packit 1422b7
add_rule 'rule=:a %{"name":"numbers", "type":"repeat",
Packit 1422b7
			"parser":[
Packit 1422b7
			    {"name":"n1", "type":"number"},
Packit 1422b7
			    {"type":"literal", "text":":"},
Packit 1422b7
			    {"name":"n2", "type":"number"}
Packit 1422b7
			  ],
Packit 1422b7
			"while": {
Packit 1422b7
			    "type":"alternative", "parser": [
Packit 1422b7
			        {"type":"literal", "text":", "},
Packit 1422b7
			        {"type":"literal", "text":","}
Packit 1422b7
			     ]
Packit 1422b7
			 }
Packit 1422b7
       		   }% b %w:word%
Packit 1422b7
'
Packit 1422b7
execute 'a 1:2, 3:4,5:6, 7:8 b test'
Packit 1422b7
assert_output_json_eq '{ "w": "test", "numbers": [ { "n2": "2", "n1": "1" }, { "n2": "4", "n1": "3" }, { "n2": "6", "n1": "5" }, { "n2": "8", "n1": "7" } ] }'
Packit 1422b7
Packit 1422b7
cleanup_tmp_files