<commit_before>Feature: C++ compilation rule
  As a reggae user
  I want to have reggae determine the implicit dependencies when compiling a single C++ file
  So that I don't have to specify the dependencies myself

  Scenario: Mixing C++ and D files
    Given a file named "mixproj/src/d/main.d" with:
      """
      extern(C++) int calc(int i);
      import std.stdio;
      import std.conv;
      void main(string[] args) {
          immutable number = args[1].to!int;
          immutable result = calc(number);
          writeln(`The result of calc(`, number, `) is `, result);
      }
      """

    And a file named "mixproj/src/cpp/maths.cpp" with:
      """
      #include "maths.hpp"
      int calc(int i) {
          return i * factor;
      }
      """
    And a file named "mixproj/headers/maths.hpp" with:
      """
      const int factor = 3;
      """
    And a file named "mixproj/reggaefile.d" with:
      """
      import reggae;
      const mainObj  = dCompile(`src/d/main.d`);
      const mathsObj = cppCompile(`src/cpp/maths.cpp`, ``, [`headers`]);
      mixin build!(Target(`calc`, `dmd -of$out $in`, [mainObj, mathsObj]));
      """
    When I successfully run `reggae -b ninja mixproj`
    And I successfully run `ninja`
    And I successfully run `./calc 5`
    Then the output should contain:
      """
      The result of calc(5) is 15
      """
    Given I successfully run `sleep 1` for up to 1 seconds
    And I overwrite "mixproj/headers/maths.hpp" with:
      """
      const int factor = 10;
      """
    When I successfully run `ninja`
    And I successfully run `./calc 3`
    Then the output should contain:
      """
      The result of calc(3) is 30
      """<commit_msg>cppcompiler.feature failing for Make<commit_after>Feature: C++ compilation rule
  As a reggae user
  I want to have reggae determine the implicit dependencies when compiling a single C++ file
  So that I don't have to specify the dependencies myself

  Background:
    Given a file named "mixproj/src/d/main.d" with:
      """
      extern(C++) int calc(int i);
      import std.stdio;
      import std.conv;
      void main(string[] args) {
          immutable number = args[1].to!int;
          immutable result = calc(number);
          writeln(`The result of calc(`, number, `) is `, result);
      }
      """

    And a file named "mixproj/src/cpp/maths.cpp" with:
      """
      #include "maths.hpp"
      int calc(int i) {
          return i * factor;
      }
      """
    And a file named "mixproj/headers/maths.hpp" with:
      """
      const int factor = 3;
      """
    And a file named "mixproj/reggaefile.d" with:
      """
      import reggae;
      const mainObj  = dCompile(`src/d/main.d`);
      const mathsObj = cppCompile(`src/cpp/maths.cpp`, ``, [`headers`]);
      mixin build!(Target(`calc`, `dmd -of$out $in`, [mainObj, mathsObj]));
      """

  Scenario: Mixing C++ and D files with Ninja
    When I successfully run `reggae -b ninja mixproj`
    And I successfully run `ninja`
    And I successfully run `./calc 5`
    Then the output should contain:
      """
      The result of calc(5) is 15
      """
    Given I successfully run `sleep 1` for up to 1 seconds
    And I overwrite "mixproj/headers/maths.hpp" with:
      """
      const int factor = 10;
      """
    When I successfully run `ninja`
    And I successfully run `./calc 3`
    Then the output should contain:
      """
      The result of calc(3) is 30
      """

  Scenario: Mixing C++ and D files with Make
    When I successfully run `reggae -b make mixproj`
    And I successfully run `make`
    And I successfully run `./calc 5`
    Then the output should contain:
      """
      The result of calc(5) is 15
      """
    Given I successfully run `sleep 1` for up to 1 seconds
    And I overwrite "mixproj/headers/maths.hpp" with:
      """
      const int factor = 10;
      """
    When I successfully run `make`
    And I successfully run `./calc 3`
    Then the output should contain:
      """
      The result of calc(3) is 30
      """
{'fraction_non_alphanumeric': 0.11486319940842987, 'fraction_numerical': 0.009859502095144195, 'mean_word_length': 2.228321400159109, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6583429', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1232, 'n_words': 460}