From b9fd1fbf6cb698a69164fe8390cbf8573d58b716 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sun, 22 Nov 2020 02:38:35 +0000 Subject: [PATCH] Remove duplicated test selection print --- lib/mutant.rb | 1 - .../reporter/cli/printer/isolation_result.rb | 6 ---- .../reporter/cli/printer/mutation_result.rb | 1 - .../reporter/cli/printer/test_result.rb | 29 ------------------- .../reporter/cli/printer/env_result_spec.rb | 3 -- .../cli/printer/isolation_result_spec.rb | 18 ++---------- .../cli/printer/mutation_result_spec.rb | 15 ---------- .../cli/printer/subject_result_spec.rb | 3 -- .../reporter/cli/printer/test_result_spec.rb | 14 --------- 9 files changed, 2 insertions(+), 88 deletions(-) delete mode 100644 lib/mutant/reporter/cli/printer/test_result.rb delete mode 100644 spec/unit/mutant/reporter/cli/printer/test_result_spec.rb diff --git a/lib/mutant.rb b/lib/mutant.rb index f46e02449..5b2680d1f 100644 --- a/lib/mutant.rb +++ b/lib/mutant.rb @@ -186,7 +186,6 @@ module Mutant require 'mutant/reporter/cli/printer/mutation_result' require 'mutant/reporter/cli/printer/status_progressive' require 'mutant/reporter/cli/printer/subject_result' -require 'mutant/reporter/cli/printer/test_result' require 'mutant/reporter/cli/format' require 'mutant/repository' require 'mutant/repository/diff' diff --git a/lib/mutant/reporter/cli/printer/isolation_result.rb b/lib/mutant/reporter/cli/printer/isolation_result.rb index dab88c0e4..7b3d1f825 100644 --- a/lib/mutant/reporter/cli/printer/isolation_result.rb +++ b/lib/mutant/reporter/cli/printer/isolation_result.rb @@ -47,7 +47,6 @@ class IsolationResult < self # @return [undefined] def run print_timeout - print_tests print_process_status print_log_messages print_exception @@ -55,11 +54,6 @@ def run private - def print_tests - value = object.value or return - visit(TestResult, value) - end - def print_log_messages log = object.log diff --git a/lib/mutant/reporter/cli/printer/mutation_result.rb b/lib/mutant/reporter/cli/printer/mutation_result.rb index 9dde94175..07a3c1c44 100644 --- a/lib/mutant/reporter/cli/printer/mutation_result.rb +++ b/lib/mutant/reporter/cli/printer/mutation_result.rb @@ -62,7 +62,6 @@ def run def print_details visit_isolation_result - puts(SEPARATOR) __send__(MAP.fetch(mutation.class)) end diff --git a/lib/mutant/reporter/cli/printer/test_result.rb b/lib/mutant/reporter/cli/printer/test_result.rb deleted file mode 100644 index fb2ea4a60..000000000 --- a/lib/mutant/reporter/cli/printer/test_result.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -module Mutant - class Reporter - class CLI - class Printer - # Test result reporter - class TestResult < self - - delegate :tests, :runtime - - STATUS_FORMAT = '- %d @ runtime: %s' - TEST_FORMAT = ' - %s' - - # Run test result reporter - # - # @return [undefined] - def run - info(STATUS_FORMAT, tests.length, runtime) - tests.each do |test| - info(TEST_FORMAT, test.identification) - end - end - - end # TestResult - end # Printer - end # CLI - end # Reporter -end # Mutant diff --git a/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb index a2e9f07fa..56235e0be 100644 --- a/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb @@ -13,9 +13,6 @@ - test-a evil:subject-a:d27d2 ----------------------- - - 1 @ runtime: 1.0 - - test-a - ----------------------- @@ -1 +1 @@ -true +false diff --git a/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb index 0a196043b..7b46e55a8 100644 --- a/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb @@ -21,10 +21,7 @@ describe '.call' do context 'on successful isolation' do - it_reports <<~'STR' - - 1 @ runtime: 1.0 - - test-a - STR + it_reports '' end context 'on exception isolation error' do @@ -41,8 +38,6 @@ def backtrace end it_reports <<~'STR' - - 1 @ runtime: 1.0 - - test-a Killing the mutation resulted in an integration error. This is the case when the tests selected for the current mutation did not produce a test result, but instead an exception was raised. @@ -67,8 +62,6 @@ def backtrace let(:log) { 'log message' } it_reports <<~'STR' - - 1 @ runtime: 1.0 - - test-a Log messages (combined stderr and stdout): [killfork] log message STR @@ -80,8 +73,6 @@ def backtrace end it_reports <<~'STR' - - 1 @ runtime: 1.0 - - test-a Killfork exited nonzero. Its result (if any) was ignored. Process status: # @@ -93,10 +84,7 @@ def backtrace instance_double(Process::Status, 'unsuccessful status', success?: true) end - it_reports <<~'STR' - - 1 @ runtime: 1.0 - - test-a - STR + it_reports '' end context 'on timeout while process exits successful' do @@ -108,8 +96,6 @@ def backtrace it_reports <<~'STR' Mutation analysis ran into the configured timeout of 02 seconds. - - 1 @ runtime: 1.0 - - test-a STR end diff --git a/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb index 5d8e06e4f..80958c89e 100644 --- a/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb @@ -20,9 +20,6 @@ [ [Unparser::Color::NONE, "evil:subject-a:d27d2\n"], [Unparser::Color::NONE, "-----------------------\n"], - [Unparser::Color::NONE, "- 1 @ runtime: 1.0\n"], - [Unparser::Color::NONE, " - test-a\n"], - [Unparser::Color::NONE, "-----------------------\n"], [Unparser::Color::NONE, "@@ -1 +1 @@\n"], [Unparser::Color::RED, "-true\n"], [Unparser::Color::GREEN, "+false\n"], @@ -35,9 +32,6 @@ it_reports(<<~'STR') evil:subject-a:d27d2 ----------------------- - - 1 @ runtime: 1.0 - - test-a - ----------------------- @@ -1 +1 @@ -true +false @@ -56,9 +50,6 @@ it_reports(<<~REPORT) evil:subject-a:a5bc7 ----------------------- - - 1 @ runtime: 1.0 - - test-a - ----------------------- --- Internal failure --- BUG: A generted mutation did not result in exactly one diff hunk! This is an invariant violation by the mutation generation engine. @@ -86,9 +77,6 @@ it_reports(<<~REPORT) neutral:subject-a:d5318 ----------------------- - - 1 @ runtime: 1.0 - - test-a - ----------------------- --- Neutral failure --- Original code was inserted unmutated. And the test did NOT PASS. Your tests do not pass initially or you found a bug in mutant / unparser. @@ -110,9 +98,6 @@ it_reports(<<~REPORT) noop:subject-a:d5318 ----------------------- - - 1 @ runtime: 1.0 - - test-a - ----------------------- ---- Noop failure ----- No code was inserted. And the test did NOT PASS. This is typically a problem of your specs not passing unmutated. diff --git a/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb index 727273c2e..902f9c3d2 100644 --- a/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb @@ -21,9 +21,6 @@ - test-a evil:subject-a:d27d2 ----------------------- - - 1 @ runtime: 1.0 - - test-a - ----------------------- @@ -1 +1 @@ -true +false diff --git a/spec/unit/mutant/reporter/cli/printer/test_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/test_result_spec.rb deleted file mode 100644 index 66c55ab3e..000000000 --- a/spec/unit/mutant/reporter/cli/printer/test_result_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Mutant::Reporter::CLI::Printer::TestResult do - setup_shared_context - - let(:reportable) { mutation_a_test_result } - - describe '.call' do - it_reports <<~'STR' - - 1 @ runtime: 1.0 - - test-a - STR - end -end