<commit_before>Feature: D code as a target command
  As a reggae user
  I want to be able to specify D code instead of a shell command
  So I can do complicated D builds

  Scenario: Printing instead of compiling
    Given a file named "proj/reggaefile.d" with:
      """
      import reggae;
      import std.stdio;
      void func(in string[], in string[]) { writeln(`func was called`); }
      mixin build!(Target(`copy.txt`, &func, Target(`original.txt`)));
      """

    And I successfully run `reggae -b binary proj`
    When I run `./build`
    Then the output should contain:
      """
      func was called
      """<commit_msg>Scenario for code_command that actually produces output<commit_after>Feature: D code as a target command
  As a reggae user
  I want to be able to specify D code instead of a shell command
  So I can do complicated D builds

  Scenario: Printing instead of compiling
    Given a file named "proj/reggaefile.d" with:
      """
      import reggae;
      import std.stdio;
      void func(in string[], in string[]) { writeln(`func was called`); }
      mixin build!(Target(`copy.txt`, &func, Target(`original.txt`)));
      """

    And I successfully run `reggae -b binary proj`
    When I run `./build`
    Then the output should contain:
      """
      func was called
      """

  Scenario: Generation of outputs
    Given a file named "proj/reggaefile.d" with:
      """
      import reggae;
      import std.process;
      import std.exception;
      import std.array;
      void func(in string[] inputs, in string[] outputs) {
          immutable cmd = [`cp`, inputs[0], outputs[0]];
          immutable res = execute(cmd);
          enforce(res.status == 0, `Could not execute ` ~ cmd.join(` `) ~ `\n` ~ res.output);
      }
      mixin build!(Target(`copy.txt`, &func, Target(`original.txt`)));
      """

    And a file named "proj/original.txt" with:
      """
      Originalis
      """

    When I successfully run `reggae -b binary proj`
    And I run `./build`
    And I run `cat copy.txt`
    Then the output should contain:
      """
      Originalis
      """
{'fraction_non_alphanumeric': 0.11258278145695365, 'fraction_numerical': 0.0014191106906338694, 'mean_word_length': 2.4786184210526314, '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': '4486015', 'n_tokens_mistral': 632, 'n_tokens_neox': 619, 'n_words': 239}