Merge pull request #766 from mbj/some/maintenance

Some maintenance
This commit is contained in:
Markus Schirp 2018-11-19 12:09:56 +00:00 committed by GitHub
commit 53b152e0d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 22 deletions

View file

@ -1,12 +1,6 @@
# frozen_string_literal: true
RSpec.describe 'Mutant on ruby corpus', mutant: false do
before do
skip 'Corpus test is deactivated on < 2.1' if RUBY_VERSION < '2.1'
skip 'Corpus test is deactivated on RBX' if RUBY_ENGINE.eql?('rbx')
end
MutantSpec::Corpus::Project::ALL.select(&:mutation_generation).each do |project|
specify "#{project.name} does not fail on mutation generation" do
project.verify_mutation_generation
@ -14,7 +8,7 @@ RSpec.describe 'Mutant on ruby corpus', mutant: false do
end
MutantSpec::Corpus::Project::ALL.select(&:mutation_coverage).each do |project|
specify "#{project.name} does have expected mutation coverage" do
specify "#{project.name} (#{project.integration}) does have expected mutation coverage" do
project.verify_mutation_coverage
end
end

View file

@ -3,6 +3,7 @@
namespace: Rubyspec
repo_uri: 'https://github.com/ruby/rubyspec.git'
repo_ref: 'origin/master'
integration: mspec
ruby_glob_pattern: '**/*_spec.rb'
mutation_coverage: false
mutation_generation: true
@ -24,6 +25,7 @@
namespace: Regexp
repo_uri: 'https://github.com/ammar/regexp_parser.git'
repo_ref: 'v1.2.0'
integration: rspec
ruby_glob_pattern: '**/*.rb'
mutation_coverage: false
mutation_generation: true
@ -34,6 +36,7 @@
repo_uri: 'https://github.com/mbj/auom.git'
repo_ref: 'origin/master'
ruby_glob_pattern: '**/*.rb'
integration: rspec
mutation_coverage: true
mutation_generation: true
expected_errors: {}
@ -43,6 +46,7 @@
repo_uri: 'https://github.com/dkubb/axiom.git'
repo_ref: 'origin/master'
ruby_glob_pattern: '**/*.rb'
integration: rspec
mutation_coverage: false
mutation_generation: true
expected_errors: {}

View file

@ -6,22 +6,25 @@ RSpec.shared_examples_for 'framework integration' do
end
around do |example|
Dir.chdir(TestApp.root) do
Kernel.system('bundle', 'install', '--gemfile', gemfile) || fail('Bundle install failed!')
example.run
Bundler.with_clean_env do
Dir.chdir(TestApp.root) do
Kernel.system('bundle', 'install', '--gemfile', gemfile) || fail('Bundle install failed!')
example.run
end
end
end
specify 'it allows to kill mutations' do
expect(Kernel.system("#{base_cmd} TestApp::Literal#string")).to be(true)
expect(system_with_gemfile("#{base_cmd} TestApp::Literal#string")).to be(true)
end
specify 'it allows to exclude mutations' do
cli = <<-CMD.split("\n").join(' ')
#{base_cmd}
--ignore-subject TestApp::Literal#uncovered_string
--
TestApp::Literal#string
TestApp::Literal#uncovered_string
--ignore-subject TestApp::Literal#uncovered_string
CMD
expect(system_with_gemfile(cli)).to be(true)
end

View file

@ -37,6 +37,7 @@ module MutantSpec
:expected_errors,
:mutation_coverage,
:mutation_generation,
:integration,
:name,
:namespace,
:repo_uri,
@ -54,16 +55,18 @@ module MutantSpec
def verify_mutation_coverage
checkout
Dir.chdir(repo_path) do
install_mutant
system(
%W[
bundle exec mutant
--use rspec
--include lib
--require #{name}
#{namespace}*
]
)
Bundler.with_clean_env do
install_mutant
system(
%W[
bundle exec mutant
--use #{integration}
--include lib
--require #{name}
#{namespace}*
]
)
end
end
end
@ -313,6 +316,7 @@ module MutantSpec
s(:key_symbolize, :ruby_glob_pattern, s(:guard, s(:primitive, String))),
s(:key_symbolize, :name, s(:guard, s(:primitive, String))),
s(:key_symbolize, :namespace, s(:guard, s(:primitive, String))),
s(:key_symbolize, :integration, s(:guard, s(:primitive, String))),
s(:key_symbolize, :mutation_coverage,
s(:guard, s(:or, s(:primitive, TrueClass), s(:primitive, FalseClass)))),
s(:key_symbolize, :mutation_generation,