Skip to content

Commit

Permalink
Merge pull request #1446 from mbj/fix/coverage
Browse files Browse the repository at this point in the history
Fix coverage
  • Loading branch information
mbj authored May 12, 2024
2 parents a8b5509 + 761a43b commit f352d9e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
11 changes: 5 additions & 6 deletions lib/mutant/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,13 @@ def self.load(cli_config:, world:)
#
# @return [Either<String,Config>]
def self.load_config_file(reporter:, world:)
files = CANDIDATES
.map(&world.pathname.public_method(:new))
.select(&:readable?)
files = CANDIDATES.map(&world.pathname.public_method(:new)).select(&:readable?)

if files.one?
load_contents(reporter: reporter, path: files.first).fmap(&DEFAULT.public_method(:with))
elsif files.empty?
case files
in []
Either::Right.new(DEFAULT)
in [file]
load_contents(reporter: reporter, path: file).fmap(&DEFAULT.public_method(:with))
else
Either::Left.new(MORE_THAN_ONE_CONFIG_FILE % files.join(', '))
end
Expand Down
9 changes: 4 additions & 5 deletions lib/mutant/expression/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ class Parser
# @return [nil]
# otherwise
def call(input)
expressions = expressions(input)
case expressions.length
when 0
case expressions(input)
in []
Either::Left.new("Expression: #{input.inspect} is invalid")
when 1
Either::Right.new(expressions.first)
in [expression]
Either::Right.new(expression)
else
Either::Left.new("Expression: #{input.inspect} is ambiguous")
end
Expand Down
3 changes: 2 additions & 1 deletion lib/mutant/integration/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def example_group_map
end
memoize :example_group_map

# mutant:disable -- 3.3 specific mutation on match.captures -> match
def parse_metadata(metadata)
if metadata.key?(:mutant_expression)
expression = metadata.fetch(:mutant_expression)
Expand All @@ -167,7 +168,7 @@ def parse_metadata(metadata)
expressions.map(&method(:parse_expression))
else
match = EXPRESSION_CANDIDATE.match(metadata.fetch(:full_description))
[parse_expression(match.captures.first) { ALL_EXPRESSION }]
[parse_expression(Util.one(match.captures)) { ALL_EXPRESSION }]
end
end

Expand Down

0 comments on commit f352d9e

Please sign in to comment.