<commit_before>Feature: Developer runs commands with incorrect configuration
  As a Developer
  I want to be sure that nothing bad happens when there are
  problems with config files

  Scenario: Running patch:up without config
    When I run command "patch:up"
    Then I should see "Configuration file not found!"

  Scenario: Running patch:up with incorrect config file that doesnt parse
    Given the file "stamp.yml" contains:
      """
      a  b c: def
        fdsa
       -
      """
    When I run command "patch:up"
    Then I should see 'Unable to parse at line 2 (near "  fdsa").'

  Scenario: Running patch:up with config without mandatory filename
    Given the file "stamp.yml" contains:
      """
      regex:       one
      replacement: two
      """
    When I run command "patch:up"
    Then I should see 'Cannot find "filename" entry in config file!'

  Scenario: Running patch:up with config without mandatory regex
    Given the file "stamp.yml" contains:
      """
      filename:    three
      replacement: two
      """
    When I run command "patch:up"
    Then I should see 'Cannot find "regex" entry in config file!'

  Scenario: Running patch:up with config without mandatory replacement
    Given the file "stamp.yml" contains:
      """
      filename: three
      regex:    two
      """
    When I run command "patch:up"
    Then I should see 'Cannot find "replacement" entry in config file!'

  Scenario: Running patch:up when file defined in filename doesnt exist
    Given the file "stamp.yml" contains:
      """
      filename:    one
      regex:       two
      replacement: three
      """
    When I run command "patch:up"
    Then I should see 'The file "one" does not exist!'

  Scenario: Running patch:up when regex in config is incorrect
    Given the file "stamp.yml" contains:
      """
      filename:    one
      regex:       '/abc'
      replacement: three
      """
    And the file "one" contains:
      """
      some content...
      """
    When I run command "patch:up"
    Then I should see 'Error during parsing regex "/abc" from config file!'

  Scenario: Running patch:up when regex doesnt contain any named subpatterns
    Given the file "stamp.yml" contains:
      """
      filename:    one
      regex:       '/abc/'
      replacement: three
      """
    And the file "one" contains:
      """
      some content...
      """
    When I run command "patch:up"
    Then I should see 'Regex "/abc/" does not match anything in the file "one"!'
<commit_msg>Behat tests: regex must contain named subpatterns<commit_after>Feature: Developer runs commands with incorrect configuration
  As a Developer
  I want to be sure that nothing bad happens when there are
  problems with config files

  Scenario: Running patch:up without config
    When I run command "patch:up"
    Then I should see "Configuration file not found!"

  Scenario: Running patch:up with incorrect config file that doesnt parse
    Given the file "stamp.yml" contains:
      """
      a  b c: def
        fdsa
       -
      """
    When I run command "patch:up"
    Then I should see 'Unable to parse at line 2 (near "  fdsa").'

  Scenario: Running patch:up with config without mandatory filename
    Given the file "stamp.yml" contains:
      """
      regex:       one
      replacement: two
      """
    When I run command "patch:up"
    Then I should see 'Cannot find "filename" entry in config file!'

  Scenario: Running patch:up with config without mandatory regex
    Given the file "stamp.yml" contains:
      """
      filename:    three
      replacement: two
      """
    When I run command "patch:up"
    Then I should see 'Cannot find "regex" entry in config file!'

  Scenario: Running patch:up with config without mandatory replacement
    Given the file "stamp.yml" contains:
      """
      filename: three
      regex:    two
      """
    When I run command "patch:up"
    Then I should see 'Cannot find "replacement" entry in config file!'

  Scenario: Running patch:up when file defined in filename doesnt exist
    Given the file "stamp.yml" contains:
      """
      filename:    one
      regex:       two
      replacement: three
      """
    When I run command "patch:up"
    Then I should see 'The file "one" does not exist!'

  Scenario: Running patch:up when regex in config is incorrect
    Given the file "stamp.yml" contains:
      """
      filename:    one
      regex:       '/abc'
      replacement: three
      """
    And the file "one" contains:
      """
      some content...
      """
    When I run command "patch:up"
    Then I should see 'Error during parsing regex "/abc" from config file!'

  Scenario: Running patch:up when regex doesnt match anything in the file
    Given the file "stamp.yml" contains:
      """
      filename:    one
      regex:       '/xyz/'
      replacement: three
      """
    And the file "one" contains:
      """
      some content...
      """
    When I run command "patch:up"
    Then I should see 'Regex "/xyz/" does not match!'

  Scenario: Running patch:up when regex doesnt contain any named subpatterns
    Given the file "stamp.yml" contains:
      """
      filename:    one
      regex:       '/a/'
      replacement: three
      """
    And the file "one" contains:
      """
      abc
      """
    When I run command "patch:up"
    Then I should see 'Regex "/a/" does not contain any named subpatterns!'

{'fraction_non_alphanumeric': 0.08298068077276909, 'fraction_numerical': 0.0003679852805887764, 'mean_word_length': 2.3308823529411766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '252397', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1459, 'n_words': 666}