<commit_before>// global.Fiber = require('fibers');

global.waiting = function(runner) {
  var newValue;
  var fiber = Fiber.current;
  runner(function(data) {
    newValue = data;
    fiber.run();
  });
  Fiber.yield();
  return newValue;
}

Object.prototype.runSync = function() {
  var newValue;
  var fiber = Fiber.current;

  var args = Array.prototype.slice.call(arguments);
  var methodName = args.shift();

  args.push(function(data) {
    newValue = data;
    fiber.run();
  });

  this[methodName].apply(this, args);
  Fiber.yield();
  return newValue;
};

Object.prototype.wrapSync = function(methodName) {
  var _this = this;

  return function () {
    var fiber = Fiber.current;
    var newValue;
    var args = Array.prototype.slice.call(arguments);
    args.push(function(data) {
      newValue = data;
      fiber.run();
    });

    _this[methodName].apply(_this, args);
    Fiber.yield();
    return newValue;
  };
};

global.loadBddBase = function () {
  global.bdd = require('../lib/bdd/bdd');
  var asserts = require('../lib/bdd/bdd_assert');

  global.describe = bdd.describe;

  global.assert = asserts.assert;
  global.assert_true = asserts.assert_true;
  global.assert_match = asserts.assert_match;
  global.assert_contain = asserts.assert_contain;

  process.on("uncaughtException", function(err) {
    bdd.onError(err);
  });
};

global.loadTestCases = function (path) {
  var testFiles = node.fs.readdirSync(node.path.resolve(__dirname, path));

  if (process.argv.length > 2) {
    var pattern = process.argv[2];
    testFiles = testFiles.filter(function(file) {
      return file.indexOf(pattern) != -1;
    });
  }

  testFiles.forEach(function (file) {
    require(node.path.resolve(__dirname, path, file));
  });
};<commit_msg>Add support for nw arguments<commit_after>// global.Fiber = require('fibers');

global.waiting = function(runner) {
  var newValue;
  var fiber = Fiber.current;
  runner(function(data) {
    newValue = data;
    fiber.run();
  });
  Fiber.yield();
  return newValue;
}

Object.prototype.runSync = function() {
  var newValue;
  var fiber = Fiber.current;

  var args = Array.prototype.slice.call(arguments);
  var methodName = args.shift();

  args.push(function(data) {
    newValue = data;
    fiber.run();
  });

  this[methodName].apply(this, args);
  Fiber.yield();
  return newValue;
};

Object.prototype.wrapSync = function(methodName) {
  var _this = this;

  return function () {
    var fiber = Fiber.current;
    var newValue;
    var args = Array.prototype.slice.call(arguments);
    args.push(function(data) {
      newValue = data;
      fiber.run();
    });

    _this[methodName].apply(_this, args);
    Fiber.yield();
    return newValue;
  };
};

global.loadBddBase = function () {
  global.bdd = require('../lib/bdd/bdd');
  var asserts = require('../lib/bdd/bdd_assert');

  global.describe = bdd.describe;

  global.assert = asserts.assert;
  global.assert_true = asserts.assert_true;
  global.assert_match = asserts.assert_match;
  global.assert_contain = asserts.assert_contain;

  process.on("uncaughtException", function(err) {
    bdd.onError(err);
  });
};

global.loadTestCases = function (path) {
  var testFiles = node.fs.readdirSync(node.path.resolve(__dirname, path));

  var args;
  if (global.GUI) {
    args = global.GUI.App.argv;
  } else {
    args = process.argv.slice(2);
  }

  if (args.length > 0) {
    var pattern = args[0];
    testFiles = testFiles.filter(function(file) {
      return file.indexOf(pattern) != -1;
    });
  }

  testFiles.forEach(function (file) {
    require(node.path.resolve(__dirname, path, file));
  });
};
{'fraction_non_alphanumeric': 0.153232462173315, 'fraction_numerical': 0.0019257221458046766, 'mean_word_length': 3.4072727272727272, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5239947', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1219, 'n_words': 225}