diff --git a/tests/test_parse.py b/tests/test_parse.py index 72eb22d..e12b6d3 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -227,6 +227,22 @@ return new_tokens +# Generate text with a StartText token in it +# We expect the following behaviour: +# - Error if a StartText token is in the text content +@composite +def draw_syntax_text_invalid_extrastarttext(draw): + (tokens, _) = draw(draw_syntax_text_valid()) + s_value = draw(test_tokenize.draw_token_keyword()) + s_value.value = "StartText" + s_location = draw(draw_syntax_location()) + s_type = parse.SyntaxType.TOKEN + start = parse.Syntax(s_value, s_location, s_type) + pos = draw(integers(min_value=1, max_value=(len(tokens) - 1))) + new_tokens = tokens[0:pos] + [start] + tokens[pos:] + return new_tokens + + # Generate text without EndText # We expect the following behaviour: # - Error if there is no EndText node at all @@ -242,6 +258,7 @@ strategies = [ draw_syntax_text_invalid_nostarttext(), draw_syntax_text_invalid_invalidcontent(), + draw_syntax_text_invalid_extrastarttext(), draw_syntax_text_invalid_noendtext(), ] return draw(one_of(strategies))