diff --git a/lib/mutant/meta/example/verification.rb b/lib/mutant/meta/example/verification.rb index e59c6b5e..fd19723a 100644 --- a/lib/mutant/meta/example/verification.rb +++ b/lib/mutant/meta/example/verification.rb @@ -34,12 +34,24 @@ module Mutant # Unexpected mutations # - # @return [Array] + # @return [Array] def unexpected - mutations.map(&:node) - example.expected + mutations.reject do |mutation| + example.expected.include?(mutation.node) + end end memoize :unexpected + # Missing mutations + # + # @return [Array] + def missing + (example.expected - mutations.map(&:node)).map do |node| + Mutation::Evil.new(self, node) + end + end + memoize :missing + # Mutations with no diff to original # # @return [Enumerable] @@ -50,14 +62,14 @@ module Mutant # Mutation report # - # @param [Array] nodes + # @param [Array] mutations # # @return [Array] - def format_mutations(nodes) - nodes.map do |node| + def format_mutations(mutations) + mutations.map do |mutation| { - 'node' => node.inspect, - 'source' => Unparser.unparse(node) + 'node' => mutation.node.inspect, + 'source' => mutation.source } end end @@ -74,14 +86,6 @@ module Mutant end end - # Missing mutations - # - # @return [Array] - def missing - example.expected - mutations.map(&:node) - end - memoize :missing - end # Verification end # Example end # Meta