Sha256: 2adfcdef7541cc198a7d9962e4db15fb41b74c71188e15ab89959a98b52bfd54

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

# encoding: utf-8

module Mutant
  class Runner
    # Mutation runner
    class Mutation < self
      include Equalizer.new(:config, :mutation, :tests)

      register Mutant::Mutation

      # Return mutation
      #
      # @return [Mutation]
      #
      # @api private
      #
      attr_reader :mutation

      # Return killers
      #
      # @return [Enumerable<Runner::Killer>]
      #
      # @api private
      #
      attr_reader :killers

      # Initialize object
      #
      # @param [Config] config
      # @param [Mutation] mutation
      # @param [Enumerable<Test>] tests
      #
      # @return [undefined]
      #
      # @api private
      #
      def initialize(config, mutation, tests)
        @mutation, @tests = mutation, tests
        super(config)
        @stop = config.fail_fast && !success?
      end

      # Test if mutation was handeled successfully
      #
      # @return [true]
      #   if successful
      #
      # @return [false]
      #   otherwise
      #
      # @api private
      #
      def success?
        killers.any?(&:success?)
      end

    private

      # Perform operation
      #
      # @return [undefined]
      #
      # @api private
      #
      def run
        progress(mutation)
        @killers = @tests.map do |test|
          Mutant::Killer.new(
            mutation: mutation,
            test:     test
          )
        end.map(&method(:visit))
        progress(self)
      end

    end # Mutation
  end # Runner
end # Mutant

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mutant-0.5.16 lib/mutant/runner/mutation.rb
mutant-0.5.15 lib/mutant/runner/mutation.rb
mutant-0.5.14 lib/mutant/runner/mutation.rb
mutant-0.5.13 lib/mutant/runner/mutation.rb