<commit_before>library dherkin_example;

import "dart:io";
import "dart:async";
import "dart:mirrors";
import "../lib/dherkin.dart";

void main() {
  var scanner = new StepdefScanner();
  var parser = new GherkinParser();
  scanner.scan().then((stepRunners) {
    var future = parser.parse(new File("example/gherkin/test_feature.feature"));

    future.then((feature) {
      print("MAIN: $feature");

      var missingSteps = "";

      Future.forEach(feature.scenarios, ((Scenario scenario) {
        Map ctx = {};
        scenario.steps.forEach((String stepString) {
          var step = stepRunners[stepString];

          if(step == null) {
            print("Undefinded step: $stepString");
            var chunks = stepString.replaceAll(new RegExp("\""), "").split(new RegExp(" "));
            var end = chunks.length > 2 ? 3 : chunks.length;
            var functionName = chunks.sublist(0, end).join("_").toLowerCase();
            missingSteps += "\n@StepDef(\"$stepString\")\n$functionName(ctx) {\n}\n";
          } else {
            step(ctx);
          }
        });
      })).whenComplete(() => print(missingSteps));
    });
  });
}

//  Output verbiage for missing stepdefs

//***************
@StepDef("parser is working")
step1(ctx) {
  print("Компрессия! $ctx");
}<commit_msg>changed missing stepdef message<commit_after>library dherkin_example;

import "dart:io";
import "dart:async";
import "dart:mirrors";
import "../lib/dherkin.dart";

void main() {
  var scanner = new StepdefScanner();
  var parser = new GherkinParser();
  scanner.scan().then((stepRunners) {
    var future = parser.parse(new File("example/gherkin/test_feature.feature"));

    future.then((feature) {

      var missingSteps = "";

      Future.forEach(feature.scenarios, ((Scenario scenario) {
        Map ctx = {};
        scenario.steps.forEach((String stepString) {
          var step = stepRunners[stepString];

          if(step == null) {
            print("Undefinded step: $stepString");
            var chunks = stepString.replaceAll(new RegExp("\""), "").split(new RegExp(" "));
            var end = chunks.length > 2 ? 3 : chunks.length;
            var functionName = chunks.sublist(0, end).join("_").toLowerCase();
            missingSteps += "\n@StepDef(\"$stepString\")\n$functionName(ctx) {\n// todo \n}\n";
          } else {
            step(ctx);
          }
        });
      })).whenComplete(() => print(missingSteps));
    });
  });
}


//***************
@StepDef("parser is working")
step1(ctx) {
  print("Компрессия! $ctx");
}

@StepDef("I run dherkin")
i_run_dherkin(ctx) {
  print("УРА!");
}
{'fraction_non_alphanumeric': 0.18178339073861463, 'fraction_numerical': 0.0030616150019135095, 'mean_word_length': 2.8441176470588236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1497539', 'n_tokens_mistral': 838, 'n_tokens_neox': 831, 'n_words': 161}