free_mutant/lib/mutant.rb

226 lines
6.7 KiB
Ruby
Raw Normal View History

2012-11-26 06:16:22 -05:00
require 'abstract_type'
require 'adamantium'
require 'anima'
require 'concord'
require 'digest/sha1'
2012-08-16 12:02:03 -04:00
require 'diff/lcs'
require 'diff/lcs/hunk'
require 'equalizer'
require 'ice_nine'
require 'morpher'
require 'open3'
require 'optparse'
require 'parallel'
require 'parser'
require 'parser/current'
require 'pathname'
require 'set'
require 'stringio'
require 'unparser'
2014-10-08 11:00:46 -04:00
# This setting is done to make errors within the parallel
# reporter / execution visible in the main thread.
Thread.abort_on_exception = true
# Library namespace
module Mutant
EMPTY_STRING = ''.freeze
EMPTY_ARRAY = [].freeze
2014-06-09 21:51:33 -04:00
SCOPE_OPERATOR = '::'.freeze
2014-06-08 14:03:11 -04:00
# Test if CI is detected via environment
#
# @return [Boolean]
#
# @api private
#
def self.ci?
ENV.key?('CI')
end
# Define instance of subclassed superclass as constant
#
# @param [Class] superclass
# @param [Symbol] name
#
# @return [self]
#
# @api private
#
2014-12-21 20:28:30 -05:00
# rubocop:disable MethodLength
#
def self.singleton_subclass_instance(name, superclass, &block)
klass = Class.new(superclass) do
def inspect
self.class.name
end
define_singleton_method(:name) do
"#{superclass.name}::#{name}".freeze
end
end
klass.class_eval(&block)
superclass.const_set(name, klass.new)
self
end
end # Mutant
require 'mutant/version'
require 'mutant/env'
require 'mutant/env/bootstrap'
require 'mutant/ast'
require 'mutant/ast/sexp'
require 'mutant/ast/types'
require 'mutant/ast/nodes'
require 'mutant/ast/named_children'
require 'mutant/ast/node_predicates'
require 'mutant/ast/meta'
2014-10-23 07:37:53 -04:00
require 'mutant/actor'
require 'mutant/actor/receiver'
require 'mutant/actor/sender'
require 'mutant/actor/mailbox'
require 'mutant/actor/env'
require 'mutant/cache'
require 'mutant/delegator'
require 'mutant/isolation'
2014-12-08 19:10:31 -05:00
require 'mutant/parallel'
require 'mutant/parallel/master'
require 'mutant/parallel/worker'
require 'mutant/parallel/source'
2014-03-29 16:18:23 -04:00
require 'mutant/warning_filter'
2014-04-04 08:38:06 -04:00
require 'mutant/require_highjack'
require 'mutant/mutator'
2012-08-15 22:09:14 -04:00
require 'mutant/mutation'
require 'mutant/mutator/registry'
require 'mutant/mutator/util'
require 'mutant/mutator/util/array'
require 'mutant/mutator/util/symbol'
require 'mutant/mutator/node'
require 'mutant/mutator/node/generic'
require 'mutant/mutator/node/literal'
require 'mutant/mutator/node/literal/boolean'
require 'mutant/mutator/node/literal/range'
require 'mutant/mutator/node/literal/symbol'
require 'mutant/mutator/node/literal/string'
require 'mutant/mutator/node/literal/fixnum'
require 'mutant/mutator/node/literal/float'
require 'mutant/mutator/node/literal/array'
require 'mutant/mutator/node/literal/hash'
require 'mutant/mutator/node/literal/regex'
require 'mutant/mutator/node/literal/nil'
2013-06-04 17:44:17 -04:00
require 'mutant/mutator/node/argument'
require 'mutant/mutator/node/arguments'
2013-09-09 02:08:44 -04:00
require 'mutant/mutator/node/blockarg'
2013-06-04 16:16:04 -04:00
require 'mutant/mutator/node/begin'
require 'mutant/mutator/node/binary'
require 'mutant/mutator/node/const'
2013-09-08 00:28:37 -04:00
require 'mutant/mutator/node/dstr'
2013-09-08 11:17:47 -04:00
require 'mutant/mutator/node/dsym'
2013-11-03 23:51:55 -05:00
require 'mutant/mutator/node/kwbegin'
require 'mutant/mutator/node/named_value/access'
2013-07-23 03:23:21 -04:00
require 'mutant/mutator/node/named_value/constant_assignment'
require 'mutant/mutator/node/named_value/variable_assignment'
require 'mutant/mutator/node/next'
require 'mutant/mutator/node/break'
require 'mutant/mutator/node/noop'
require 'mutant/mutator/node/or_asgn'
require 'mutant/mutator/node/and_asgn'
require 'mutant/mutator/node/defined'
2013-09-08 02:03:25 -04:00
require 'mutant/mutator/node/op_asgn'
require 'mutant/mutator/node/conditional_loop'
2013-11-03 15:37:47 -05:00
require 'mutant/mutator/node/yield'
2013-01-01 17:28:21 -05:00
require 'mutant/mutator/node/super'
2013-07-23 04:02:29 -04:00
require 'mutant/mutator/node/zsuper'
2013-09-07 22:49:55 -04:00
require 'mutant/mutator/node/restarg'
require 'mutant/mutator/node/send'
require 'mutant/mutator/node/send/binary'
require 'mutant/mutator/node/send/attribute_assignment'
require 'mutant/mutator/node/send/index'
require 'mutant/mutator/node/when'
require 'mutant/mutator/node/define'
2013-06-14 14:19:53 -04:00
require 'mutant/mutator/node/mlhs'
2013-08-02 19:36:13 -04:00
require 'mutant/mutator/node/nthref'
require 'mutant/mutator/node/masgn'
require 'mutant/mutator/node/return'
2013-06-14 14:19:53 -04:00
require 'mutant/mutator/node/block'
require 'mutant/mutator/node/if'
2013-06-14 12:22:34 -04:00
require 'mutant/mutator/node/case'
2013-07-15 16:25:09 -04:00
require 'mutant/mutator/node/splat'
require 'mutant/mutator/node/resbody'
require 'mutant/mutator/node/rescue'
require 'mutant/mutator/node/match_current_line'
2013-04-17 23:31:21 -04:00
require 'mutant/loader'
require 'mutant/context'
require 'mutant/context/scope'
2012-08-01 12:34:03 -04:00
require 'mutant/subject'
2013-01-13 16:25:49 -05:00
require 'mutant/subject/method'
require 'mutant/subject/method/instance'
require 'mutant/subject/method/singleton'
require 'mutant/matcher'
require 'mutant/matcher/config'
require 'mutant/matcher/compiler'
require 'mutant/matcher/chain'
require 'mutant/matcher/method'
require 'mutant/matcher/method/singleton'
require 'mutant/matcher/method/instance'
require 'mutant/matcher/methods'
require 'mutant/matcher/namespace'
require 'mutant/matcher/scope'
2013-09-08 15:58:39 -04:00
require 'mutant/matcher/filter'
2014-02-13 10:47:29 -05:00
require 'mutant/matcher/null'
require 'mutant/expression'
require 'mutant/expression/method'
require 'mutant/expression/methods'
require 'mutant/expression/namespace'
require 'mutant/test'
2014-06-28 19:04:18 -04:00
require 'mutant/integration'
require 'mutant/selector'
require 'mutant/selector/expression'
require 'mutant/config'
require 'mutant/cli'
2012-08-16 12:02:03 -04:00
require 'mutant/color'
2014-05-11 11:04:11 -04:00
require 'mutant/diff'
2014-07-17 09:59:25 -04:00
require 'mutant/runner'
2014-12-08 19:10:31 -05:00
require 'mutant/runner/sink'
require 'mutant/result'
require 'mutant/reporter'
require 'mutant/reporter/null'
require 'mutant/reporter/trace'
require 'mutant/reporter/cli'
require 'mutant/reporter/cli/printer'
2015-05-02 20:21:30 -04:00
require 'mutant/reporter/cli/printer/config'
require 'mutant/reporter/cli/printer/env_result'
require 'mutant/reporter/cli/printer/env_progress'
require 'mutant/reporter/cli/printer/mutation_result'
require 'mutant/reporter/cli/printer/mutation_progress_result'
require 'mutant/reporter/cli/printer/subject_progress'
require 'mutant/reporter/cli/printer/subject_result'
require 'mutant/reporter/cli/printer/status'
require 'mutant/reporter/cli/printer/status_progressive'
require 'mutant/reporter/cli/printer/test_result'
require 'mutant/reporter/cli/tput'
require 'mutant/reporter/cli/format'
require 'mutant/zombifier'
module Mutant
# Reopen class to initialize constant to avoid dep circle
class Config
CI_DEFAULT_PROCESSOR_COUNT = 4
DEFAULT = new(
debug: false,
fail_fast: false,
integration: Integration::Null.new,
matcher: Matcher::Config::DEFAULT,
includes: EMPTY_ARRAY,
requires: EMPTY_ARRAY,
isolation: Mutant::Isolation::Fork,
reporter: Reporter::CLI.build($stdout),
zombie: false,
2014-12-08 19:10:31 -05:00
jobs: Mutant.ci? ? CI_DEFAULT_PROCESSOR_COUNT : ::Parallel.processor_count,
2015-03-05 23:46:03 -05:00
expected_coverage: Rational(1)
)
end # Config
end # Mutant