Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pattern match crash #1418

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
38 changes: 19 additions & 19 deletions 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 All @@ -17,38 +17,38 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
diff-lcs (1.5.0)
diff-lcs (1.5.1)
json (2.7.1)
language_server-protocol (3.17.0.3)
parallel (1.24.0)
parser (3.3.0.2)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
racc (1.7.3)
rainbow (3.1.1)
regexp_parser (2.8.3)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (~> 3.13.0)
rspec-its (1.3.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.12.6)
rspec-mocks (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.59.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.0)
rubocop (1.60.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
Expand All @@ -58,11 +58,11 @@ GEM
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
ruby-progressbar (1.13.0)
sorbet-runtime (0.5.11180)
sorbet-runtime (0.5.11238)
unicode-display_width (2.5.0)
unparser (0.6.12)
unparser (0.6.13)
diff-lcs (~> 1.3)
parser (>= 3.2.2.4)
parser (>= 3.3.0)

PLATFORMS
ruby
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