#!/bin/bash
# added 2026-05-05 by AI agent
# This file is part of the liblognorm project, released under ASL 2.0

# shellcheck source=tests/exec.sh disable=SC1091,SC2154
. "$srcdir"/exec.sh

test_def "$0" "repeat while clause with named parser does not segfault"

add_rule 'version=2'
add_rule 'rule=:a %
        {"name":"numbers", "type":"repeat",
            "parser":
                     {"type":"number", "name":"n"},
            "while":
                     {"type":"char-to", "name":"host", "extradata":":"}
         }% b'

execute 'a 1 : 2 b'
assert_output_json_eq '{ "originalmsg": "a 1 : 2 b", "unparsed-data": "1 : 2 b" }'

cleanup_tmp_files
