<commit_before>Feature: Pretty formatter - Printing messages

  When you want to print to Cucumber's output, just call `puts` from
  a step definition. Cucumber will grab the output and print it via
  the formatter that you're using.
  
  Your message will be printed out after the step has run.

  Background:
    Given a file named "features/step_definitions/steps.rb" with:
      """
      Given /^I use puts with text "(.*)"$/ do |ann|
        puts(ann)
      end

      Given /^I use multiple putss$/ do
        puts("Multiple")
        puts("Announce","Me")
      end

      Given /^I use message (.+) in line (.+) (?:with result (.+))$/ do |ann, line, result|
        puts("Last message") if line == "3"
        puts("Line: #{line}: #{ann}")
        fail if result =~ /fail/i
      end

      Given /^I use puts and step fails$/ do
        puts("Announce with fail")
        fail
      end

      Given(/^this step works$/) { }

      Given /^I puts the world$/ do
        puts(self)
      end
      """
    And a file named "features/f.feature" with:
      """
      Feature:

        Scenario:
          Given I use puts with text "Ann"
          And this step works

        Scenario:
          Given I use multiple putss
          And this step works

        Scenario Outline:
          Given I use message <ann> in line <line>

          Examples:
            | line | ann   |
            | 1    | anno1 |
            | 2    | anno2 |
            | 3    | anno3 |

        Scenario:
          Given I use puts and step fails
          And this step works

        Scenario Outline:
          Given I use message <ann> in line <line> with result <result>

          Examples:
            | line | ann   | result |
            | 1    | anno1 | fail   |
            | 2    | anno2 | pass   |
      """

    And a file named "features/puts_world.feature" with:
      """
      Feature: puts_world
        Scenario: puts_world
          Given I puts the world
      """

    # Don't know why, but we need to spawn this for JRuby otherwise it gives wierd errors
    @spawn
    Scenario: Delayed messages feature
      When I run `cucumber --quiet --format pretty features/f.feature`
      Then the stderr should not contain anything
      And the output should contain:
      """
      Feature: 

        Scenario: 
          Given I use puts with text "Ann"
            Ann
          And this step works

        Scenario: 
          Given I use multiple putss
            Multiple
            Announce
            Me
          And this step works

        Scenario Outline: 
          Given I use message <ann> in line <line>

          Examples: 
            | line | ann   |
            | 1    | anno1 |
            | 2    | anno2 |
            | 3    | anno3 |

        Scenario: 
          Given I use puts and step fails
            Announce with fail
             (RuntimeError)
            ./features/step_definitions/steps.rb:18:in `/^I use puts and step fails$/'
            features/f.feature:21:in `Given I use puts and step fails'
          And this step works

        Scenario Outline: 
          Given I use message <ann> in line <line> with result <result>

          Examples: 
            | line | ann   | result |
            | 1    | anno1 | fail   |  Line: 1: anno1
             (RuntimeError)
            ./features/step_definitions/steps.rb:13:in `/^I use message (.+) in line (.+) (?:with result (.+))$/'
            features/f.feature:25:in `Given I use message <ann> in line <line> with result <result>'
            | 2    | anno2 | pass   |  Line: 2: anno2
      """

    Scenario: Non-delayed messages feature (progress formatter)
      When I run `cucumber --format progress features/f.feature`
      Then the output should contain:
        """
        Ann
        ..
        Multiple

        Announce
        Me
        ..-UUUUUU
        Announce with fail
        F--
        Line: 1: anno1
        FFF
        Line: 2: anno2
        ...
        """

<commit_msg>Use standard step defs in Printing messages Feature<commit_after>Feature: Pretty formatter - Printing messages

  When you want to print to Cucumber's output, just call `puts` from
  a step definition. Cucumber will grab the output and print it via
  the formatter that you're using.
  
  Your message will be printed out after the step has run.

  Background:
    Given the standard step definitions
    And a file named "features/step_definitions/puts_steps.rb" with:
      """
      Given /^I use puts with text "(.*)"$/ do |ann|
        puts(ann)
      end

      Given /^I use multiple putss$/ do
        puts("Multiple")
        puts("Announce","Me")
      end

      Given /^I use message (.+) in line (.+) (?:with result (.+))$/ do |ann, line, result|
        puts("Last message") if line == "3"
        puts("Line: #{line}: #{ann}")
        fail if result =~ /fail/i
      end

      Given /^I use puts and step fails$/ do
        puts("Announce with fail")
        fail
      end

      Given /^I puts the world$/ do
        puts(self)
      end
      """
    And a file named "features/f.feature" with:
      """
      Feature:

        Scenario:
          Given I use puts with text "Ann"
          And this step passes

        Scenario:
          Given I use multiple putss
          And this step passes

        Scenario Outline:
          Given I use message <ann> in line <line>

          Examples:
            | line | ann   |
            | 1    | anno1 |
            | 2    | anno2 |
            | 3    | anno3 |

        Scenario:
          Given I use puts and step fails
          And this step passes

        Scenario Outline:
          Given I use message <ann> in line <line> with result <result>

          Examples:
            | line | ann   | result |
            | 1    | anno1 | fail   |
            | 2    | anno2 | pass   |
      """

    And a file named "features/puts_world.feature" with:
      """
      Feature: puts_world
        Scenario: puts_world
          Given I puts the world
      """

    # Don't know why, but we need to spawn this for JRuby otherwise it gives wierd errors
    @spawn
    Scenario: Delayed messages feature
      When I run `cucumber --quiet --format pretty features/f.feature`
      Then the stderr should not contain anything
      And the output should contain:
      """
      Feature: 

        Scenario: 
          Given I use puts with text "Ann"
            Ann
          And this step passes

        Scenario: 
          Given I use multiple putss
            Multiple
            Announce
            Me
          And this step passes

        Scenario Outline: 
          Given I use message <ann> in line <line>

          Examples: 
            | line | ann   |
            | 1    | anno1 |
            | 2    | anno2 |
            | 3    | anno3 |

        Scenario: 
          Given I use puts and step fails
            Announce with fail
             (RuntimeError)
            ./features/step_definitions/puts_steps.rb:18:in `/^I use puts and step fails$/'
            features/f.feature:21:in `Given I use puts and step fails'
          And this step passes

        Scenario Outline: 
          Given I use message <ann> in line <line> with result <result>

          Examples: 
            | line | ann   | result |
            | 1    | anno1 | fail   |  Line: 1: anno1
             (RuntimeError)
            ./features/step_definitions/puts_steps.rb:13:in `/^I use message (.+) in line (.+) (?:with result (.+))$/'
            features/f.feature:25:in `Given I use message <ann> in line <line> with result <result>'
            | 2    | anno2 | pass   |  Line: 2: anno2
      """

    Scenario: Non-delayed messages feature (progress formatter)
      When I run `cucumber --format progress features/f.feature`
      Then the output should contain:
        """
        Ann
        ..
        Multiple

        Announce
        Me
        ..-UUUUUU
        Announce with fail
        F--
        Line: 1: anno1
        FFF
        Line: 2: anno2
        ...
        """


{'fraction_non_alphanumeric': 0.0872691211106979, 'fraction_numerical': 0.00917317466220404, 'mean_word_length': 1.4680330376261854, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7585571', 'n_tokens_mistral': 2385, 'n_tokens_neox': 2236, 'n_words': 849}