Add kwoptarg mutations
This commit is contained in:
parent
2bcbfde35a
commit
b71c04fade
4 changed files with 12 additions and 5 deletions
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
threshold: 16
|
||||
total_score: 1160
|
||||
total_score: 1166
|
||||
|
|
|
@ -37,7 +37,12 @@ module Mutant
|
|||
# Mutator for optional arguments
|
||||
class Optional < self
|
||||
|
||||
handle(:optarg)
|
||||
TYPE_MAP = IceNine.deep_freeze(
|
||||
optarg: :arg,
|
||||
kwoptarg: :kwarg
|
||||
)
|
||||
|
||||
handle(:optarg, :kwoptarg)
|
||||
|
||||
children :name, :default
|
||||
|
||||
|
@ -56,7 +61,7 @@ module Mutant
|
|||
#
|
||||
# @return [undefined]
|
||||
def emit_required_mutation
|
||||
emit(s(:arg, name))
|
||||
emit(s(TYPE_MAP.fetch(node.type), name))
|
||||
end
|
||||
|
||||
end # Optional
|
||||
|
|
|
@ -9,7 +9,7 @@ module Mutant
|
|||
# your contribution is that close!
|
||||
handle(
|
||||
:ensure, :redo, :regopt, :retry, :arg_expr, :blockarg,
|
||||
:kwrestarg, :kwoptarg, :undef, :module, :empty,
|
||||
:kwrestarg, :undef, :module, :empty,
|
||||
:alias, :for, :xstr, :back_ref, :class, :restarg,
|
||||
:sclass, :match_with_lvasgn, :while_post,
|
||||
:until_post, :preexe, :postexe, :iflipflop, :eflipflop, :kwsplat,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Mutant::Meta::Example.add :kwoptarg do
|
||||
Mutant::Meta::Example.add :kwarg do
|
||||
source 'def foo(bar: baz); end'
|
||||
|
||||
mutation 'def foo; end'
|
||||
|
@ -6,4 +6,6 @@ Mutant::Meta::Example.add :kwoptarg do
|
|||
mutation 'remove_method(:foo)'
|
||||
mutation 'def foo(bar: nil); end'
|
||||
mutation 'def foo(bar: self); end'
|
||||
mutation 'def foo(bar:); end'
|
||||
mutation 'def foo(_bar: baz); end'
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue