Change to use 2.3 squiggly heredocs
This commit is contained in:
parent
99ab9ff171
commit
c66e462682
17 changed files with 54 additions and 65 deletions
|
@ -59,7 +59,6 @@ end # MessageHelper
|
|||
|
||||
RSpec.configure do |config|
|
||||
config.extend(SharedContext)
|
||||
config.include(CompressHelper)
|
||||
config.include(MessageHelper)
|
||||
config.include(ParserHelper)
|
||||
config.include(Mutant::AST::Sexp)
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
module CompressHelper
|
||||
def strip_indent(string)
|
||||
lines = string.lines
|
||||
match = /\A( *)/.match(lines.first)
|
||||
return string unless match
|
||||
whitespaces = match[1].to_s.length
|
||||
lines.map { |line| line[whitespaces..-1] }.join
|
||||
end
|
||||
end # CompressHelper
|
|
@ -28,7 +28,7 @@ module SharedContext
|
|||
it 'writes expected report to output' do
|
||||
described_class.call(output, reportable)
|
||||
output.rewind
|
||||
expect(output.read).to eql(strip_indent(expected_content))
|
||||
expect(output.read).to eql(expected_content)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -108,21 +108,21 @@ RSpec.describe Mutant::CLI do
|
|||
it_should_behave_like 'a cli parser'
|
||||
|
||||
let(:expected_message) do
|
||||
strip_indent(<<-MESSAGE)
|
||||
usage: mutant [options] MATCH_EXPRESSION ...
|
||||
Environment:
|
||||
--zombie Run mutant zombified
|
||||
-I, --include DIRECTORY Add DIRECTORY to $LOAD_PATH
|
||||
-r, --require NAME Require file with NAME
|
||||
-j, --jobs NUMBER Number of kill jobs. Defaults to number of processors.
|
||||
<<~MESSAGE
|
||||
usage: mutant [options] MATCH_EXPRESSION ...
|
||||
Environment:
|
||||
--zombie Run mutant zombified
|
||||
-I, --include DIRECTORY Add DIRECTORY to $LOAD_PATH
|
||||
-r, --require NAME Require file with NAME
|
||||
-j, --jobs NUMBER Number of kill jobs. Defaults to number of processors.
|
||||
|
||||
Options:
|
||||
--use INTEGRATION Use INTEGRATION to kill mutations
|
||||
--ignore-subject EXPRESSION Ignore subjects that match EXPRESSION as prefix
|
||||
--since REVISION Only select subjects touched since REVISION
|
||||
--fail-fast Fail fast
|
||||
--version Print mutants version
|
||||
-h, --help Show this message
|
||||
Options:
|
||||
--use INTEGRATION Use INTEGRATION to kill mutations
|
||||
--ignore-subject EXPRESSION Ignore subjects that match EXPRESSION as prefix
|
||||
--since REVISION Only select subjects touched since REVISION
|
||||
--fail-fast Fail fast
|
||||
--version Print mutants version
|
||||
-h, --help Show this message
|
||||
MESSAGE
|
||||
end
|
||||
end
|
||||
|
|
|
@ -56,7 +56,7 @@ RSpec.describe Mutant::Diff do
|
|||
let(:new) { %w[baz bar baz] }
|
||||
|
||||
let(:expectation) do
|
||||
strip_indent(<<-STR)
|
||||
<<~STR
|
||||
@@ -1,4 +1,4 @@
|
||||
-foo
|
||||
+baz
|
||||
|
@ -76,7 +76,7 @@ RSpec.describe Mutant::Diff do
|
|||
let(:new) { %w[baz bar] }
|
||||
|
||||
let(:expectation) do
|
||||
strip_indent(<<-STR)
|
||||
<<~STR
|
||||
@@ -1,3 +1,3 @@
|
||||
-foo
|
||||
+baz
|
||||
|
@ -94,7 +94,7 @@ RSpec.describe Mutant::Diff do
|
|||
let(:new) { %w[foo baz bar] }
|
||||
|
||||
let(:expectation) do
|
||||
strip_indent(<<-STR)
|
||||
<<~STR
|
||||
@@ -1,3 +1,4 @@
|
||||
foo
|
||||
+baz
|
||||
|
@ -112,7 +112,7 @@ RSpec.describe Mutant::Diff do
|
|||
let(:new) { %w[foo bar baz boz a b c other] }
|
||||
|
||||
let(:expectation) do
|
||||
strip_indent(<<-STR)
|
||||
<<~STR
|
||||
@@ -1,8 +1,9 @@
|
||||
foo
|
||||
bar
|
||||
|
@ -135,7 +135,7 @@ RSpec.describe Mutant::Diff do
|
|||
let(:new) { %w[foo bar baz boz a b c] }
|
||||
|
||||
let(:expectation) do
|
||||
strip_indent(<<-STR)
|
||||
<<~STR
|
||||
@@ -1,9 +1,8 @@
|
||||
-other
|
||||
foo
|
||||
|
@ -158,7 +158,7 @@ RSpec.describe Mutant::Diff do
|
|||
let(:new) { %w[other foo bar baz boz a b c] }
|
||||
|
||||
let(:expectation) do
|
||||
strip_indent(<<-STR)
|
||||
<<~STR
|
||||
@@ -1,8 +1,9 @@
|
||||
+other
|
||||
foo
|
||||
|
|
|
@ -63,7 +63,7 @@ RSpec.describe Mutant::Meta::Example::Verification do
|
|||
let(:expected_nodes) { [s(:false), s(:nil)] }
|
||||
|
||||
specify do
|
||||
should eql(strip_indent(<<-'REPORT'))
|
||||
should eql(<<~'REPORT')
|
||||
---
|
||||
file: foo.rb
|
||||
original_ast: s(:true)
|
||||
|
@ -83,7 +83,7 @@ RSpec.describe Mutant::Meta::Example::Verification do
|
|||
let(:generated_nodes) { [s(:false), s(:nil)] }
|
||||
|
||||
specify do
|
||||
should eql(strip_indent(<<-'REPORT'))
|
||||
should eql(<<~'REPORT')
|
||||
---
|
||||
file: foo.rb
|
||||
original_ast: s(:true)
|
||||
|
@ -104,7 +104,7 @@ RSpec.describe Mutant::Meta::Example::Verification do
|
|||
let(:generated_nodes) { [s(:true)] }
|
||||
|
||||
specify do
|
||||
should eql(strip_indent(<<-'REPORT'))
|
||||
should eql(<<~'REPORT')
|
||||
---
|
||||
file: foo.rb
|
||||
original_ast: s(:true)
|
||||
|
|
|
@ -6,7 +6,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Config do
|
|||
|
||||
describe '.call' do
|
||||
context 'on default config' do
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
@ -17,7 +17,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Config do
|
|||
end
|
||||
|
||||
context 'with non default coverage expectation' do
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
|
|||
context 'without progress' do
|
||||
with(:subject_a_result) { { mutation_results: [] } }
|
||||
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
@ -29,7 +29,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
|
|||
end
|
||||
|
||||
context 'on full coverage' do
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
@ -52,7 +52,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
|
|||
context 'on partial coverage' do
|
||||
with(:mutation_a_test_result) { { passed: true } }
|
||||
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
|
|
@ -7,7 +7,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvResult do
|
|||
let(:reportable) { env_result }
|
||||
|
||||
describe '.call' do
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
subject-a
|
||||
- test-a
|
||||
evil:subject-a:d27d2
|
||||
|
|
|
@ -27,7 +27,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|||
end
|
||||
|
||||
context 'on non tty' do
|
||||
it_reports(<<-'STR')
|
||||
it_reports(<<~'STR')
|
||||
evil:subject-a:d27d2
|
||||
@@ -1,2 +1,2 @@
|
||||
-true
|
||||
|
@ -44,7 +44,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|||
# Unparses exactly the same way as above node
|
||||
let(:mutation_a_node) { s(:zsuper) }
|
||||
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
evil:subject-a:a5bc7
|
||||
--- Internal failure ---
|
||||
BUG: Mutation NOT resulted in exactly one diff hunk. Please report a reproduction!
|
||||
|
@ -68,7 +68,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|||
Mutant::Mutation::Neutral.new(subject_a, s(:true))
|
||||
end
|
||||
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
neutral:subject-a:d5318
|
||||
--- Neutral failure ---
|
||||
Original code was inserted unmutated. And the test did NOT PASS.
|
||||
|
@ -93,7 +93,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|||
Mutant::Mutation::Noop.new(subject_a, s(:true))
|
||||
end
|
||||
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
noop:subject-a:d5318
|
||||
---- Noop failure -----
|
||||
No code was inserted. And the test did NOT PASS.
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::StatusProgressive do
|
|||
context 'with empty scheduler' do
|
||||
with(:env_result) { { subject_results: [] } }
|
||||
|
||||
it_reports <<-REPORT
|
||||
it_reports <<~REPORT
|
||||
(00/02) 100% - killtime: 0.00s runtime: 4.00s overhead: 4.00s
|
||||
REPORT
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::StatusProgressive do
|
|||
context 'without progress' do
|
||||
with(:status) { { active_jobs: [].to_set } }
|
||||
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
(02/02) 100% - killtime: 2.00s runtime: 4.00s overhead: 2.00s
|
||||
REPORT
|
||||
end
|
||||
|
@ -28,13 +28,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::StatusProgressive do
|
|||
context 'on failure' do
|
||||
with(:mutation_a_test_result) { { passed: true } }
|
||||
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
(01/02) 50% - killtime: 2.00s runtime: 4.00s overhead: 2.00s
|
||||
REPORT
|
||||
end
|
||||
|
||||
context 'on success' do
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
(02/02) 100% - killtime: 2.00s runtime: 4.00s overhead: 2.00s
|
||||
REPORT
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|||
context 'with empty scheduler' do
|
||||
with(:env_result) { { subject_results: [] } }
|
||||
|
||||
it_reports <<-REPORT
|
||||
it_reports <<~REPORT
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
@ -33,7 +33,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|||
context 'without progress' do
|
||||
with(:status) { { active_jobs: [].to_set } }
|
||||
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
@ -60,7 +60,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|||
context 'on failure' do
|
||||
with(:mutation_a_test_result) { { passed: true } }
|
||||
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
@ -88,7 +88,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|||
end
|
||||
|
||||
context 'on success' do
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
|
|
@ -6,7 +6,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::SubjectProgress do
|
|||
|
||||
describe '.call' do
|
||||
context 'on full coverage' do
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
subject-a mutations: 2
|
||||
..
|
||||
(02/02) 100% - killtime: 2.00s runtime: 2.00s overhead: 0.00s
|
||||
|
@ -16,7 +16,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::SubjectProgress do
|
|||
context 'on partial coverage' do
|
||||
with(:mutation_a_test_result) { { passed: true } }
|
||||
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
subject-a mutations: 2
|
||||
F.
|
||||
(01/02) 50% - killtime: 2.00s runtime: 2.00s overhead: 0.00s
|
||||
|
@ -26,7 +26,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::SubjectProgress do
|
|||
context 'without results' do
|
||||
with(:subject_a_result) { { mutation_results: [] } }
|
||||
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
subject-a mutations: 2
|
||||
(00/02) 100% - killtime: 0.00s runtime: 0.00s overhead: 0.00s
|
||||
STR
|
||||
|
|
|
@ -6,7 +6,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::SubjectResult do
|
|||
|
||||
describe '.call' do
|
||||
context 'on full coverage' do
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
subject-a
|
||||
- test-a
|
||||
STR
|
||||
|
@ -15,7 +15,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::SubjectResult do
|
|||
context 'on partial coverage' do
|
||||
with(:mutation_a_test_result) { { passed: true } }
|
||||
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
subject-a
|
||||
- test-a
|
||||
evil:subject-a:d27d2
|
||||
|
@ -29,7 +29,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::SubjectResult do
|
|||
context 'without results' do
|
||||
with(:subject_a_result) { { mutation_results: [] } }
|
||||
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
subject-a
|
||||
- test-a
|
||||
STR
|
||||
|
|
|
@ -5,7 +5,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::TestResult do
|
|||
let(:reportable) { mutation_a_test_result }
|
||||
|
||||
describe '.call' do
|
||||
it_reports <<-'STR'
|
||||
it_reports <<~'STR'
|
||||
- 1 @ runtime: 1.0
|
||||
- test-a
|
||||
Test Output:
|
||||
|
|
|
@ -9,7 +9,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer do
|
|||
allow(output).to receive(:tty?).and_return(tty?)
|
||||
subject
|
||||
output.rewind
|
||||
expect(output.read).to eql(strip_indent(expectation))
|
||||
expect(output.read).to eql(expectation)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ RSpec.describe Mutant::Reporter::CLI do
|
|||
def self.it_reports(expected_content)
|
||||
it 'writes expected report to output' do
|
||||
expect(subject).to be(object)
|
||||
expect(contents).to eql(strip_indent(expected_content))
|
||||
expect(contents).to eql(expected_content)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -119,7 +119,7 @@ RSpec.describe Mutant::Reporter::CLI do
|
|||
context 'on progressive format' do
|
||||
let(:format) { progressive_format }
|
||||
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
@ -137,7 +137,7 @@ RSpec.describe Mutant::Reporter::CLI do
|
|||
describe '#report' do
|
||||
subject { object.report(env_result) }
|
||||
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
@ -163,7 +163,7 @@ RSpec.describe Mutant::Reporter::CLI do
|
|||
context 'on framed format' do
|
||||
let(:format) { framed_format }
|
||||
|
||||
it_reports(<<-REPORT)
|
||||
it_reports(<<~REPORT)
|
||||
[tput-restore]Mutant configuration:
|
||||
Matcher: #<Mutant::Matcher::Config empty>
|
||||
Integration: Mutant::Integration::Null
|
||||
|
|
Loading…
Reference in a new issue