<commit_before>require_relative 'test_helper'

class Defekt::RunnerTest < Minitest::Test
  def setup
    stub(FakeTest, :descendants, [FakeTest])
    collection = Defekt::Collection.new(FakeTest)
    @runner = Defekt::Runner.new(collection)
  end

  def test_initialize
    assert_instance_of Defekt::Runner, @runner
  end

  def test_collection
    assert_instance_of Defekt::Collection, @runner.collection
  end

  def test_benchmark
    stub(@runner, :print, nil)
    @runner.run
    assert_instance_of Benchmark::Tms, @runner.benchmark
  end

  def test_run
    assert_output(/^[.fe]{3}$/) { @runner.run }
    assert @runner.collection.all.map(&:ran?).all?
    stub(@runner, :print, nil)
    assert_equal @runner, @runner.run
  end

  def test_report
    assert_output { @runner.run }
    stub(@runner, :print, nil)
    stub(@runner, :puts, nil)
    assert_equal @runner, @runner.run.report
  end

  def test_statistics
    stub(@runner, :print, nil)
    @runner.run
    regex = /^\d+ passed, \d+ failed, \d+ errored of \d+ tests \(in \d+\.\d+ seconds\)$/
    assert_match regex, @runner.statistics
  end
end<commit_msg>change regex to format<commit_after>require_relative 'test_helper'

class Defekt::RunnerTest < Minitest::Test
  def setup
    stub(FakeTest, :descendants, [FakeTest])
    collection = Defekt::Collection.new(FakeTest)
    @runner = Defekt::Runner.new(collection)
  end

  def test_initialize
    assert_instance_of Defekt::Runner, @runner
  end

  def test_collection
    assert_instance_of Defekt::Collection, @runner.collection
  end

  def test_benchmark
    stub(@runner, :print, nil)
    @runner.run
    assert_instance_of Benchmark::Tms, @runner.benchmark
  end

  def test_run
    assert_output(/^[.fe]{3}$/) { @runner.run }
    assert @runner.collection.all.map(&:ran?).all?
    stub(@runner, :print, nil)
    assert_equal @runner, @runner.run
  end

  def test_report
    assert_output { @runner.run }
    stub(@runner, :print, nil)
    stub(@runner, :puts, nil)
    assert_equal @runner, @runner.run.report
  end

  def test_statistics
    stub(@runner, :print, nil)
    @runner.run
    format = /^\d+ passed, \d+ failed, \d+ errored of \d+ tests \(in \d+\.\d+ seconds\)$/
    assert_match format, @runner.statistics
  end
end
{'fraction_non_alphanumeric': 0.12837538733953077, 'fraction_numerical': 0.0008853474988933156, 'mean_word_length': 3.6502057613168724, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7444994', 'n_tokens_mistral': 778, 'n_tokens_neox': 777, 'n_words': 178}