<commit_before>require 'test_helper'
require 'tunit/god_reporter'

module Tunit
  class GodReporterTest < TestCase
    def setup
      @reporter = GodReporter.new
      @reporter << SummaryReporter.new(io)
      @reporter << ProgressReporter.new(io)
    end
    attr_reader :reporter

    def test_shuffle_operator
      reporter = GodReporter.new
      assert_empty reporter.reporters

      reporter << :some_reporter
      refute_empty reporter.reporters
    ensure
      reporter.reporters.clear
    end

    def test_start
      assert_empty reporter.reporters.map(&:start_time).compact
      reporter.start

      refute_empty reporter.reporters.map(&:start_time).compact
    end

    def test_reporters
      refute_empty reporter.reporters
    end

    def test_passed_eh
      reporter.record PassingTest.new.run
      assert reporter.passed?
    end

    def test_passed_eh_fails_of_any_reporter_failed
      reporter.record FailingTest.new.run
      refute reporter.passed?
    end

    def test_record
      reporter.record PassingTest.new.run
      reporter_count = reporter.reporters.map(&:count).inject(:+)

      assert_equal 1, reporter_count
    end

    def test_report
      reporter.start
      reporter.record PassingTest.new.run
      reporter.report
      exp_report = <<-EOS
Run options: {}

# Running:

.

Finished in 0.000000s, 00000.0000 runs/s, 00000.0000 assertions/s.

0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
EOS

      assert_equal exp_report, zeroify_time(io.string)
    end
  end
end
<commit_msg>Remove unnecessary `ensure`<commit_after>require 'test_helper'
require 'tunit/god_reporter'

module Tunit
  class GodReporterTest < TestCase
    def setup
      @reporter = GodReporter.new
      @reporter << SummaryReporter.new(io)
      @reporter << ProgressReporter.new(io)
    end
    attr_reader :reporter

    def test_shuffle_operator
      reporter = GodReporter.new
      assert_empty reporter.reporters

      reporter << :some_reporter
      refute_empty reporter.reporters
    end

    def test_start
      assert_empty reporter.reporters.map(&:start_time).compact
      reporter.start

      refute_empty reporter.reporters.map(&:start_time).compact
    end

    def test_reporters
      refute_empty reporter.reporters
    end

    def test_passed_eh
      reporter.record PassingTest.new.run
      assert reporter.passed?
    end

    def test_passed_eh_fails_of_any_reporter_failed
      reporter.record FailingTest.new.run
      refute reporter.passed?
    end

    def test_record
      reporter.record PassingTest.new.run
      reporter_count = reporter.reporters.map(&:count).inject(:+)

      assert_equal 1, reporter_count
    end

    def test_report
      reporter.start
      reporter.record PassingTest.new.run
      reporter.report
      exp_report = <<-EOS
Run options: {}

# Running:

.

Finished in 0.000000s, 00000.0000 runs/s, 00000.0000 assertions/s.

0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
EOS

      assert_equal exp_report, zeroify_time(io.string)
    end
  end
end

{'fraction_non_alphanumeric': 0.0700261780104712, 'fraction_numerical': 0.020287958115183247, 'mean_word_length': 2.9042145593869733, 'pattern_counts': {'":': 0, '<': 21, '<?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': '2863797', 'n_tokens_mistral': 1043, 'n_tokens_neox': 958, 'n_words': 210}