Fix add into duplicated collection into binary op
* Preference is to not mutate values, even when the mutation appears to be "safe" as the mutated value looks "safe". Monkeypatching, refactoring whatever in the future can violate what appears to be "safe" now.
This commit is contained in:
parent
dfa8a8ae6d
commit
104afe3bcf
4 changed files with 6 additions and 6 deletions
|
@ -207,7 +207,7 @@ module Mutant
|
|||
#
|
||||
# @api private
|
||||
def add(attribute, value)
|
||||
update(attribute => config.public_send(attribute).dup << value)
|
||||
update(attribute => config.public_send(attribute) + [value])
|
||||
end
|
||||
|
||||
# Add matcher configuration
|
||||
|
|
|
@ -41,7 +41,7 @@ module Mutant
|
|||
#
|
||||
# @api private
|
||||
def add(attribute, value)
|
||||
update(attribute => public_send(attribute).dup << value)
|
||||
update(attribute => public_send(attribute) + [value])
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -79,7 +79,7 @@ module Mutant
|
|||
original = @subject_results[mutation.subject]
|
||||
|
||||
@subject_results[mutation.subject] = original.update(
|
||||
mutation_results: (original.mutation_results.dup << mutation_result),
|
||||
mutation_results: (original.mutation_results + [mutation_result]),
|
||||
tests: mutation_result.test_result.tests
|
||||
)
|
||||
|
||||
|
|
|
@ -221,13 +221,13 @@ Options:
|
|||
end
|
||||
end
|
||||
|
||||
context 'with require flag' do
|
||||
let(:flags) { %w[--require foo] }
|
||||
context 'with require flags' do
|
||||
let(:flags) { %w[--require foo --require bar] }
|
||||
|
||||
it_should_behave_like 'a cli parser'
|
||||
|
||||
it 'configures requires' do
|
||||
expect(subject.config.requires).to eql(%w[foo])
|
||||
expect(subject.config.requires).to eql(%w[foo bar])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue