def METHOD_NAME(bracket_seg_list, fresh_ansi_dialect):
    """Test the GreedyUntil grammar with brackets."""
    fs = StringParser("foo", KeywordSegment)
    g = GreedyUntil(fs)
    ctx = ParseContext(dialect=fresh_ansi_dialect)
    # Check that we can make it past the brackets
    match = g.match(bracket_seg_list, parse_context=ctx)
    assert len(match) == 4
    # Check we successfully constructed a bracketed segment
    assert match.matched_segments[2].is_type("bracketed")
    assert match.matched_segments[2].raw == "(foo    )"
    # Check that the unmatched segments is foo AND the whitespace
    assert len(match.unmatched_segments) == 2