def test_it_should_format_combinations_of_text_and_example_groups(self):
        feature = "\
    Feature: As a tester\n\
    I want my non example table text to remain intact\n\
    So that I don't want to kill the author of this plugin\n\
    \n\
    |cat breeds|country|\n\
    |Manx|Isle of Man|\n\
    |Octocat|The Web|\n"

        parsed = GherkinParser(feature).parse()
        text = GherkinFormatter().format(parsed)

        lines = text.split('\n')
        lines.should.have.length_of(8)
        lines[0].should.equal('    Feature: As a tester')
        lines[1].should.equal(
            '    I want my non example table text to remain intact')
        lines[2].should.equal(
            '    So that I don\'t want to kill the author of this plugin')
        lines[3].should.equal('    ')
        lines[4].should.equal('    | cat breeds | country     |')
        lines[5].should.equal('    | Manx       | Isle of Man |')
        lines[6].should.equal('    | Octocat    | The Web     |')
        lines[7].should.equal('')
Пример #2
0
  def test_it_should_format_example_group_columns_to_widest_value(self):
    examples = "\
    |cat breeds|country|\n\
    |Manx|Isle of Man|\n\
    |Octocat|The Web|\n"

    parsed = GherkinParser(examples).parse()
    text = GherkinFormatter().format(parsed)

    lines = text.split('\n')
    lines.should.have.length_of(4)
    lines[0].should.equal('    | cat breeds | country     |')
    lines[1].should.equal('    | Manx       | Isle of Man |')
    lines[2].should.equal('    | Octocat    | The Web     |')
    lines[3].should.equal('')
    def test_it_should_format_example_group_columns_to_widest_value(self):
        examples = "\
    |cat breeds|country|\n\
    |Manx|Isle of Man|\n\
    |Octocat|The Web|\n"

        parsed = GherkinParser(examples).parse()
        text = GherkinFormatter().format(parsed)

        lines = text.split('\n')
        lines.should.have.length_of(4)
        lines[0].should.equal('    | cat breeds | country     |')
        lines[1].should.equal('    | Manx       | Isle of Man |')
        lines[2].should.equal('    | Octocat    | The Web     |')
        lines[3].should.equal('')
    def test_it_should_format_tables_with_no_indent(self):
        feature = "Feature: foo\n|example1|\n|example2|\n"

        parsed = GherkinParser(feature).parse()
        text = GherkinFormatter().format(parsed)

        text.should.equal("Feature: foo\n| example1 |\n| example2 |\n")
Пример #5
0
    def run(self, edit):
        entire_buffer = sublime.Region(0, self.view.size())

        parser = GherkinParser(self.view.substr(entire_buffer))
        parsed = parser.parse()
        result = GherkinFormatter().format(parsed)

        self.view.replace(edit, entire_buffer, result)
    def test_it_should_indent_example_groups_based_on_first_line_tabs(self):
        feature = "\tFeature: foo\n\t\t|example1|\n\t|example2|\n|example3|\n"

        parsed = GherkinParser(feature).parse()
        text = GherkinFormatter().format(parsed)

        text.should.equal(
            "\tFeature: foo\n\t\t| example1 |\n\t\t| example2 |\n\t\t| example3 |\n"
        )
    def test_it_should_strip_leading_whitespace_of_text(self):
        feature = "\
    Feature: As a tester\n\
    I want my non example table text to remain intact\n\
    So that I don't want to kill the author of this plugin\n"

        parsed = GherkinParser(feature).parse()
        text = GherkinFormatter().format(parsed)

        text.should.equal(feature)
Пример #8
0
  def test_it_should_format_combinations_of_text_and_example_groups(self):
    feature = "\
    Feature: As a tester\n\
    I want my non example table text to remain intact\n\
    So that I don't want to kill the author of this plugin\n\
    \n\
    |cat breeds|country|\n\
    |Manx|Isle of Man|\n\
    |Octocat|The Web|\n"

    parsed = GherkinParser(feature).parse()
    text = GherkinFormatter().format(parsed)

    lines = text.split('\n')
    lines.should.have.length_of(8)
    lines[0].should.equal('    Feature: As a tester')
    lines[1].should.equal('    I want my non example table text to remain intact')
    lines[2].should.equal('    So that I don\'t want to kill the author of this plugin')
    lines[3].should.equal('    ')
    lines[4].should.equal('    | cat breeds | country     |')
    lines[5].should.equal('    | Manx       | Isle of Man |')
    lines[6].should.equal('    | Octocat    | The Web     |')
    lines[7].should.equal('')