<commit_before>/**
 * Module dependencies.
 */

var events = require('events')
 ,  program = require('../')
 ,  should = require('should');

//mock stdin on process
var stdin = new events.EventEmitter();
stdin.setEncoding = stdin.resume = function() {};
stdin.write = function(data) { stdin.emit('data', data); };
process.__defineGetter__('stdin', function() { return stdin });

//mock stdout on process
var stdout = new events.EventEmitter();
stdout.write = function(data) { this.emit('data', data) };
stdout.expect = function(expected, fn) {
  var actual = '';
  this.once('data', function(data){ actual = data; });
  fn();
  actual.should.equal(expected);
}
//var realOut = process.stdout;
process.__defineGetter__('stdout', function() { return stdout });

var count = 0;
var test = function(expected) {
  count++;
  return function(actual) {
    count--;
    if(expected instanceof Date) {
      //need something better :(
      //using `new Date(date.toString())` round trip
      //loosing some precision for .getTime()
      actual.should.be.an.instanceof(Date);<commit_msg>add todo<commit_after>/**
 * Module dependencies.
 */

var events = require('events')
 ,  program = require('../')
 ,  should = require('should');

// TODO: this is all super messy... rewrite

//mock stdin on process
var stdin = new events.EventEmitter();
stdin.setEncoding = stdin.resume = function() {};
stdin.write = function(data) { stdin.emit('data', data); };
process.__defineGetter__('stdin', function() { return stdin });

//mock stdout on process
var stdout = new events.EventEmitter();
stdout.write = function(data) { this.emit('data', data) };
stdout.expect = function(expected, fn) {
  var actual = '';
  this.once('data', function(data){ actual = data; });
  fn();
  actual.should.equal(expected);
}
//var realOut = process.stdout;
process.__defineGetter__('stdout', function() { return stdout });

var count = 0;
var test = function(expected) {
  count++;
  return function(actual) {
    count--;
    if(expected instanceof Date) {
      //need something better :(
      //using `new Date(date.toString())` round trip
      //loosing some precision for .getTime()
      actual.should.be.an.instanceof(Date);
{'fraction_non_alphanumeric': 0.16893732970027248, 'fraction_numerical': 0.0009082652134423251, 'mean_word_length': 3.9174107142857144, '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': '3471640', 'n_tokens_mistral': 660, 'n_tokens_neox': 663, 'n_words': 179}