Skip to content

Commit

Permalink
Fix mutation to invalid hash pattern
Browse files Browse the repository at this point in the history
[fix #1417]
  • Loading branch information
mbj committed Feb 9, 2024
1 parent 42c0dad commit 81c58fc
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 11 deletions.
5 changes: 4 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# v0.11.28
# v0.11.28 2024-02-09

* [#1418](https://github.com/mbj/mutant/pull/1418)
Fix mutation to invalid pattern match.

* [#1416](https://github.com/mbj/mutant/pull/1416)
Fix CLI parsing issue where arguments given to `mutant environment` where silently ignored.
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
mutant (0.11.27)
mutant (0.11.28)
diff-lcs (~> 1.3)
parser (~> 3.3.0)
regexp_parser (~> 2.8.2)
Expand Down
4 changes: 3 additions & 1 deletion lib/mutant/mutator/node/literal/hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class Pair < Node
private

def dispatch
emit_key_mutations
emit_key_mutations do |mutation|
!mutation.eql?(s(:nil))
end
emit_value_mutations
end

Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

module Mutant
# Current mutant version
VERSION = '0.11.27'
VERSION = '0.11.28'
end # Mutant
14 changes: 14 additions & 0 deletions meta/case.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# frozen_string_literal: true

Mutant::Meta::Example.add :case do
source <<-RUBY
case nil
in { a: nil }
end
RUBY

mutation <<~RUBY
case nil
in {a__mutant__: nil}
end
RUBY
end

Mutant::Meta::Example.add :case do
source <<-RUBY
case
Expand Down
1 change: 0 additions & 1 deletion meta/def.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@
mutation 'def foo(**); { ** }; end'
mutation 'def foo(**); { default: nil }; end'
mutation 'def foo(**); { default__mutant__: nil, ** }; end'
mutation 'def foo(**); { nil => nil, ** }; end'
mutation 'def foo(**); {}; end'
end

Expand Down
6 changes: 3 additions & 3 deletions test_app/Gemfile.minitest.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
PATH
remote: ..
specs:
mutant (0.11.27)
mutant (0.11.28)
diff-lcs (~> 1.3)
parser (~> 3.3.0)
regexp_parser (~> 2.8.2)
sorbet-runtime (~> 0.5.0)
unparser (~> 0.6.9)
mutant-minitest (0.11.27)
mutant-minitest (0.11.28)
minitest (~> 5.11)
mutant (= 0.11.27)
mutant (= 0.11.28)

GEM
remote: https://oss:Px2ENN7S91OmWaD5G7MIQJi1dmtmYrEh@gem.mutant.dev/
Expand Down
6 changes: 3 additions & 3 deletions test_app/Gemfile.rspec3.8.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
PATH
remote: ..
specs:
mutant (0.11.27)
mutant (0.11.28)
diff-lcs (~> 1.3)
parser (~> 3.3.0)
regexp_parser (~> 2.8.2)
sorbet-runtime (~> 0.5.0)
unparser (~> 0.6.9)
mutant-rspec (0.11.27)
mutant (= 0.11.27)
mutant-rspec (0.11.28)
mutant (= 0.11.28)
rspec-core (>= 3.8.0, < 4.0.0)

GEM
Expand Down

0 comments on commit 81c58fc

Please sign in to comment.