<commit_before>@regression
Feature: Regressions
  As a reggae developer
  I want to reproduce bugs with regression tests
  So that bugs are not reintroduced

  @ninja
  Scenario: Github issue 12: Can't set executable as a dependency
    Given a file named "project/reggaefile.d" with:
      """
      import reggae;
      alias app = scriptlike!(App(SourceFileName("src/main.d"), BinaryFileName("$builddir/myapp")),
                              Flags("-g -debug"),
                              ImportPaths(["/path/to/imports"])
                              );
      alias code_gen = target!("out.c", "./myapp $in $out", target!"in.txt", app);
      mixin build!(code_gen);
      """
    And a file named "project/src/main.d" with:
      """
      import std.stdio;
      import std.algorithm;
      import std.conv;
      void main(string[] args) {
          auto inFileName = args[1];
          auto outFileName = args[2];
          auto lines = File(inFileName).byLine.
                                        map!(a => a.to!string).
                                        map!(a => a ~ ` ` ~ a);
          auto outFile = File(outFileName, `w`);
          foreach(line; lines) outFile.writeln(line);
      }
      """
    And a file named "project/in.txt" with:
      """
      foo
      bar
      baz
      """
    When I successfully run `reggae -b ninja project`
    And I successfully run `ninja`
    And I successfully run `cat out.c`
    Then the output should contain:
     """
     foo foo
     bar bar
     baz baz
     """

  @ninja
  Scenario: Github issue 10: dubConfigurationTarget doesn't work for unittest builds
    Given a file named "project/dub.json" with:
      """
      {
          "name": "dubproj",
          "configurations": [
              { "name": "executable"},
              { "name": "unittest"}
          ]
      }
      """
    And a file named "project/reggaefile.d" with:
      """
      import reggae;
      alias ut = dubConfigurationTarget!(ExeName(`ut`),
                                         Configuration(`unittest`),
                                         Flags(`-g -debug -cov`));
      mixin build!ut;
      """
    And a file named "project/source/src.d" with:
      """
      unittest { static assert(false, `oopsie`); }
      int add(int i, int j) { return i + j; }
      """
    And a file named "project/source/main.d" with:
      """
      import src;
      void main() {}
      """
    Given I successfully run `reggae -b ninja project`
    When I run `ninja`
    Then it should fail with:
      """
      oopsie
      """

  @ninja
  Scenario: Using . as the project should work
    Given a file named "reggaefile.d" with:
    """
    import reggae;
    mixin build!(scriptlike!(App(SourceFileName(`app.d`))));
    """
    And a file named "app.d" with:
    """
    import std.stdio;
    void main() { writeln(`Hello world!`); }
    """
    When I successfully run `reggae -b ninja .`
    And I successfully run `ninja`
    And I successfully run `./app`
    Then the output should contain:
    """
    Hello world!
    """
<commit_msg>Deleted regression feature for issue 12<commit_after>@regression
Feature: Regressions
  As a reggae developer
  I want to reproduce bugs with regression tests
  So that bugs are not reintroduced

  @ninja
  Scenario: Github issue 10: dubConfigurationTarget doesn't work for unittest builds
    Given a file named "project/dub.json" with:
      """
      {
          "name": "dubproj",
          "configurations": [
              { "name": "executable"},
              { "name": "unittest"}
          ]
      }
      """
    And a file named "project/reggaefile.d" with:
      """
      import reggae;
      alias ut = dubConfigurationTarget!(ExeName(`ut`),
                                         Configuration(`unittest`),
                                         Flags(`-g -debug -cov`));
      mixin build!ut;
      """
    And a file named "project/source/src.d" with:
      """
      unittest { static assert(false, `oopsie`); }
      int add(int i, int j) { return i + j; }
      """
    And a file named "project/source/main.d" with:
      """
      import src;
      void main() {}
      """
    Given I successfully run `reggae -b ninja project`
    When I run `ninja`
    Then it should fail with:
      """
      oopsie
      """

  @ninja
  Scenario: Using . as the project should work
    Given a file named "reggaefile.d" with:
    """
    import reggae;
    mixin build!(scriptlike!(App(SourceFileName(`app.d`))));
    """
    And a file named "app.d" with:
    """
    import std.stdio;
    void main() { writeln(`Hello world!`); }
    """
    When I successfully run `reggae -b ninja .`
    And I successfully run `ninja`
    And I successfully run `./app`
    Then the output should contain:
    """
    Hello world!
    """

{'fraction_non_alphanumeric': 0.12159372419488026, 'fraction_numerical': 0.002064409578860446, 'mean_word_length': 1.792507204610951, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3281448', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1414, 'n_words': 440}