Skip to content

Commit 5435393

Browse files
authored
Merge pull request #892 from mbj/fix/argument-mutation
Fix argument mutation by option parser to leak to the outside
2 parents 4db4417 + 64cb247 commit 5435393

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/mutant/cli.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def parse(arguments)
8080
end
8181
end
8282

83-
parse_match_expressions(opts.parse!(arguments))
83+
parse_match_expressions(opts.parse!(arguments.dup))
8484

8585
config
8686
end

spec/unit/mutant/cli_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ def apply
142142
allow(kernel).to receive_messages(exit: nil)
143143
end
144144

145-
let(:arguments) { options + expressions }
146-
let(:expected_integration) { Mutant::Integration::Null }
147-
let(:expected_matcher_config) { default_matcher_config }
148-
let(:expressions) { %w[TestApp*] }
149-
let(:options) { [] }
145+
let(:arguments) { (options + expressions).freeze }
146+
let(:expected_integration) { Mutant::Integration::Null }
147+
let(:expected_matcher_config) { default_matcher_config }
148+
let(:expressions) { %w[TestApp*] }
149+
let(:options) { [] }
150150

151151
let(:default_matcher_config) do
152152
Mutant::Matcher::Config::DEFAULT

0 commit comments

Comments
 (0)