def METHOD_NAME(
    include_terminator, match_length, seg_list, fresh_ansi_dialect, caplog
):
    """Test the StartsWith grammar with a terminator (included & excluded)."""
    foo = StringParser("foo", KeywordSegment)
    bar = StringParser("bar", KeywordSegment)
    grammar = StartsWith(bar, terminators=[foo], include_terminator=include_terminator)
    ctx = ParseContext(dialect=fresh_ansi_dialect)
    with caplog.at_level(logging.DEBUG, logger="sqlfluff.parser"):
        m = grammar.match(seg_list, parse_context=ctx)
        assert len(m) == match_length