def test_parse_quoted_strings_on_steps(): # Given a parser loaded with the following Gherkin document # Given the following email template: # '''Here we go with a pretty # big block of text # surrounded by triple quoted strings # ''' # And a cat picture # """Now notice we didn't use (:) above # """ parser = Parser( [ (1, gherkin.TOKEN_LABEL, "Given the following email template"), (1, gherkin.TOKEN_NEWLINE, "\n"), (2, gherkin.TOKEN_QUOTES, "'''"), ( 2, gherkin.TOKEN_TEXT, """Here we go with a pretty big block of text surrounded by triple quoted strings """, ), (5, gherkin.TOKEN_QUOTES, "'''"), (5, gherkin.TOKEN_NEWLINE, "\n"), (6, gherkin.TOKEN_TEXT, "And a cat picture"), (6, gherkin.TOKEN_NEWLINE, "\n"), (7, gherkin.TOKEN_QUOTES, '"""'), (7, gherkin.TOKEN_TEXT, "Now notice we didn't use (:) above\n "), (8, gherkin.TOKEN_QUOTES, '"""'), (8, gherkin.TOKEN_NEWLINE, "\n"), (9, gherkin.TOKEN_EOF, ""), ] ) steps = parser.parse_steps() steps.should.equal( [ Ast.Step( line=1, title=Ast.Text(line=1, text="Given the following email template"), text=Ast.Text( line=2, text="""Here we go with a pretty big block of text surrounded by triple quoted strings """, ), ), Ast.Step( line=6, title=Ast.Text(line=6, text="And a cat picture"), text=Ast.Text(line=7, text="Now notice we didn't use (:) above\n "), ), ] )
def test_parse_quoted_strings_on_steps(): # Given a parser loaded with the following Gherkin document # Given the following email template: # '''Here we go with a pretty # big block of text # surrounded by triple quoted strings # ''' # And a cat picture # """Now notice we didn't use (:) above # """ parser = Parser([ (1, gherkin.TOKEN_LABEL, 'Given the following email template'), (1, gherkin.TOKEN_NEWLINE, '\n'), (2, gherkin.TOKEN_QUOTES, "'''"), (2, gherkin.TOKEN_TEXT, '''Here we go with a pretty big block of text surrounded by triple quoted strings '''), (5, gherkin.TOKEN_QUOTES, "'''"), (5, gherkin.TOKEN_NEWLINE, '\n'), (6, gherkin.TOKEN_TEXT, 'And a cat picture'), (6, gherkin.TOKEN_NEWLINE, '\n'), (7, gherkin.TOKEN_QUOTES, '"""'), (7, gherkin.TOKEN_TEXT, "Now notice we didn't use (:) above\n "), (8, gherkin.TOKEN_QUOTES, '"""'), (8, gherkin.TOKEN_NEWLINE, '\n'), (9, gherkin.TOKEN_EOF, '') ]) steps = parser.parse_steps() steps.should.equal([ Ast.Step(line=1, title=Ast.Text(line=1, text='Given the following email template'), text=Ast.Text(line=2, text='''Here we go with a pretty big block of text surrounded by triple quoted strings ''')), Ast.Step(line=6, title=Ast.Text(line=6, text='And a cat picture'), text=Ast.Text( line=7, text="Now notice we didn't use (:) above\n ")) ])