mutant 0.8.10 → 0.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -4
- data/Changelog.md +8 -0
- data/README.md +112 -43
- data/Rakefile +2 -16
- data/circle.yml +1 -1
- data/config/flay.yml +2 -2
- data/config/flog.yml +1 -1
- data/config/reek.yml +3 -4
- data/config/rubocop.yml +53 -16
- data/lib/mutant.rb +27 -6
- data/lib/mutant/ast/meta/const.rb +2 -0
- data/lib/mutant/ast/meta/optarg.rb +2 -0
- data/lib/mutant/ast/meta/resbody.rb +2 -0
- data/lib/mutant/ast/meta/restarg.rb +2 -0
- data/lib/mutant/ast/meta/send.rb +4 -0
- data/lib/mutant/ast/meta/symbol.rb +2 -0
- data/lib/mutant/ast/named_children.rb +14 -4
- data/lib/mutant/ast/nodes.rb +3 -1
- data/lib/mutant/ast/regexp.rb +53 -0
- data/lib/mutant/ast/regexp/transformer.rb +185 -0
- data/lib/mutant/ast/regexp/transformer/alternative.rb +39 -0
- data/lib/mutant/ast/regexp/transformer/character_set.rb +46 -0
- data/lib/mutant/ast/regexp/transformer/direct.rb +99 -0
- data/lib/mutant/ast/regexp/transformer/options_group.rb +66 -0
- data/lib/mutant/ast/regexp/transformer/quantifier.rb +112 -0
- data/lib/mutant/ast/regexp/transformer/recursive.rb +50 -0
- data/lib/mutant/ast/regexp/transformer/root.rb +29 -0
- data/lib/mutant/ast/regexp/transformer/text.rb +55 -0
- data/lib/mutant/ast/types.rb +92 -5
- data/lib/mutant/cli.rb +2 -14
- data/lib/mutant/color.rb +1 -1
- data/lib/mutant/config.rb +1 -3
- data/lib/mutant/expression/methods.rb +1 -1
- data/lib/mutant/expression/namespace.rb +2 -2
- data/lib/mutant/expression/parser.rb +1 -1
- data/lib/mutant/integration.rb +10 -28
- data/lib/mutant/isolation.rb +9 -60
- data/lib/mutant/isolation/fork.rb +72 -0
- data/lib/mutant/isolation/none.rb +25 -0
- data/lib/mutant/matcher/config.rb +2 -0
- data/lib/mutant/matcher/method/singleton.rb +5 -4
- data/lib/mutant/meta.rb +11 -4
- data/lib/mutant/meta/example.rb +2 -116
- data/lib/mutant/meta/example/dsl.rb +22 -19
- data/lib/mutant/meta/example/verification.rb +86 -0
- data/lib/mutant/mutator.rb +22 -49
- data/lib/mutant/mutator/node.rb +15 -19
- data/lib/mutant/mutator/node/and_asgn.rb +1 -1
- data/lib/mutant/mutator/node/argument.rb +10 -5
- data/lib/mutant/mutator/node/arguments.rb +5 -9
- data/lib/mutant/mutator/node/begin.rb +4 -17
- data/lib/mutant/mutator/node/block.rb +1 -1
- data/lib/mutant/mutator/node/break.rb +1 -1
- data/lib/mutant/mutator/node/class.rb +21 -0
- data/lib/mutant/mutator/node/conditional_loop.rb +1 -1
- data/lib/mutant/mutator/node/define.rb +1 -1
- data/lib/mutant/mutator/node/defined.rb +1 -1
- data/lib/mutant/mutator/node/dstr.rb +1 -1
- data/lib/mutant/mutator/node/dsym.rb +1 -1
- data/lib/mutant/mutator/node/generic.rb +3 -3
- data/lib/mutant/mutator/node/kwbegin.rb +1 -1
- data/lib/mutant/mutator/node/literal.rb +9 -0
- data/lib/mutant/mutator/node/literal/boolean.rb +1 -1
- data/lib/mutant/mutator/node/literal/fixnum.rb +2 -2
- data/lib/mutant/mutator/node/literal/float.rb +4 -6
- data/lib/mutant/mutator/node/literal/hash.rb +1 -1
- data/lib/mutant/mutator/node/literal/nil.rb +1 -1
- data/lib/mutant/mutator/node/literal/range.rb +2 -19
- data/lib/mutant/mutator/node/literal/regex.rb +43 -3
- data/lib/mutant/mutator/node/literal/string.rb +1 -1
- data/lib/mutant/mutator/node/literal/symbol.rb +2 -4
- data/lib/mutant/mutator/node/masgn.rb +1 -1
- data/lib/mutant/mutator/node/match_current_line.rb +1 -1
- data/lib/mutant/mutator/node/mlhs.rb +2 -3
- data/lib/mutant/mutator/node/named_value/access.rb +2 -2
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +4 -3
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +4 -4
- data/lib/mutant/mutator/node/next.rb +1 -1
- data/lib/mutant/mutator/node/nthref.rb +1 -1
- data/lib/mutant/mutator/node/or_asgn.rb +1 -1
- data/lib/mutant/mutator/node/regexp.rb +44 -0
- data/lib/mutant/mutator/node/regopt.rb +31 -0
- data/lib/mutant/mutator/node/resbody.rb +1 -1
- data/lib/mutant/mutator/node/rescue.rb +1 -3
- data/lib/mutant/mutator/node/return.rb +1 -1
- data/lib/mutant/mutator/node/send.rb +43 -3
- data/lib/mutant/mutator/node/send/attribute_assignment.rb +4 -1
- data/lib/mutant/mutator/node/send/conditional.rb +23 -0
- data/lib/mutant/mutator/node/send/index.rb +1 -1
- data/lib/mutant/mutator/node/splat.rb +1 -1
- data/lib/mutant/mutator/node/when.rb +1 -1
- data/lib/mutant/mutator/node/yield.rb +1 -1
- data/lib/mutant/mutator/util.rb +0 -30
- data/lib/mutant/mutator/util/array.rb +4 -16
- data/lib/mutant/parallel.rb +1 -1
- data/lib/mutant/parallel/worker.rb +1 -1
- data/lib/mutant/registry.rb +44 -0
- data/lib/mutant/reporter/cli/format.rb +2 -0
- data/lib/mutant/reporter/cli/printer.rb +2 -2
- data/lib/mutant/reporter/cli/printer/config.rb +0 -1
- data/lib/mutant/reporter/cli/printer/env_progress.rb +1 -11
- data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +1 -1
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +2 -0
- data/lib/mutant/reporter/cli/tput.rb +1 -1
- data/lib/mutant/reporter/sequence.rb +3 -0
- data/lib/mutant/require_highjack.rb +6 -2
- data/lib/mutant/result.rb +1 -1
- data/lib/mutant/subject.rb +5 -5
- data/lib/mutant/subject/method/instance.rb +1 -2
- data/lib/mutant/util.rb +18 -0
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/zombifier.rb +5 -3
- data/meta/and.rb +1 -1
- data/meta/and_asgn.rb +1 -1
- data/meta/array.rb +2 -2
- data/meta/begin.rb +2 -2
- data/meta/block.rb +7 -7
- data/meta/block_pass.rb +1 -1
- data/meta/blockarg.rb +1 -1
- data/meta/break.rb +1 -1
- data/meta/case.rb +2 -2
- data/meta/casgn.rb +11 -2
- data/meta/cbase.rb +1 -1
- data/meta/class.rb +10 -0
- data/meta/const.rb +9 -1
- data/meta/csend.rb +8 -0
- data/meta/cvar.rb +1 -1
- data/meta/cvasgn.rb +1 -1
- data/meta/date.rb +4 -4
- data/meta/def.rb +14 -14
- data/meta/defined.rb +1 -1
- data/meta/dstr.rb +1 -1
- data/meta/dsym.rb +1 -1
- data/meta/ensure.rb +1 -1
- data/meta/false.rb +1 -1
- data/meta/float.rb +3 -3
- data/meta/gvar.rb +1 -1
- data/meta/gvasgn.rb +1 -1
- data/meta/hash.rb +1 -1
- data/meta/if.rb +17 -3
- data/meta/int.rb +1 -1
- data/meta/ivar.rb +1 -1
- data/meta/ivasgn.rb +14 -1
- data/meta/kwarg.rb +8 -0
- data/meta/kwbegin.rb +1 -1
- data/meta/kwoptarg.rb +11 -0
- data/meta/lvar.rb +1 -1
- data/meta/lvasgn.rb +1 -1
- data/meta/masgn.rb +1 -1
- data/meta/match_current_line.rb +2 -2
- data/meta/next.rb +1 -1
- data/meta/nil.rb +1 -1
- data/meta/nthref.rb +5 -5
- data/meta/op_assgn.rb +1 -1
- data/meta/or.rb +1 -1
- data/meta/or_asgn.rb +5 -5
- data/meta/range.rb +2 -8
- data/meta/redo.rb +1 -1
- data/meta/regexp.rb +106 -0
- data/meta/regexp/regexp_bol_anchor.rb +13 -0
- data/meta/regexp/regexp_bos_anchor.rb +26 -0
- data/meta/regexp/regexp_root_expression.rb +13 -0
- data/meta/regopt.rb +8 -0
- data/meta/rescue.rb +49 -4
- data/meta/restarg.rb +6 -9
- data/meta/return.rb +2 -2
- data/meta/self.rb +1 -1
- data/meta/send.rb +228 -55
- data/meta/str.rb +1 -1
- data/meta/super.rb +3 -3
- data/meta/{symbol.rb → sym.rb} +1 -1
- data/meta/true.rb +1 -1
- data/meta/until.rb +1 -1
- data/meta/while.rb +2 -2
- data/meta/yield.rb +1 -1
- data/mutant-rspec.gemspec +2 -2
- data/mutant.gemspec +6 -5
- data/spec/integration/mutant/isolation/fork_spec.rb +8 -0
- data/spec/integration/mutant/rspec_spec.rb +1 -1
- data/spec/integration/mutant/test_mutator_handles_types_spec.rb +1 -2
- data/spec/integrations.yml +93 -24
- data/spec/spec_helper.rb +12 -7
- data/spec/support/compress_helper.rb +1 -1
- data/spec/support/corpus.rb +115 -50
- data/spec/support/fake_actor.rb +5 -5
- data/spec/support/file_system.rb +1 -1
- data/spec/support/ice_nine_config.rb +3 -3
- data/spec/support/ruby_vm.rb +11 -12
- data/spec/support/shared_context.rb +22 -13
- data/spec/support/test_app.rb +1 -1
- data/spec/support/warning.rb +64 -0
- data/spec/support/warnings.yml +4 -0
- data/spec/support/xspec.rb +177 -0
- data/spec/unit/mutant/actor/env_spec.rb +2 -2
- data/spec/unit/mutant/actor/sender_spec.rb +1 -1
- data/spec/unit/mutant/ast/meta/send_spec.rb +1 -1
- data/spec/unit/mutant/ast/named_children_spec.rb +26 -0
- data/spec/unit/mutant/ast/regexp/parse_spec.rb +7 -0
- data/spec/unit/mutant/ast/regexp/supported_predicate_spec.rb +14 -0
- data/spec/unit/mutant/ast/regexp/transformer/lookup_table/table_spec.rb +19 -0
- data/spec/unit/mutant/ast/regexp/transformer/lookup_table_spec.rb +33 -0
- data/spec/unit/mutant/ast/regexp/transformer_spec.rb +19 -0
- data/spec/unit/mutant/ast/regexp_spec.rb +617 -0
- data/spec/unit/mutant/cli_spec.rb +7 -45
- data/spec/unit/mutant/context_spec.rb +4 -7
- data/spec/unit/mutant/env/{boostrap_spec.rb → bootstrap_spec.rb} +2 -2
- data/spec/unit/mutant/env_spec.rb +13 -16
- data/spec/unit/mutant/expression/namespace/{flat_spec.rb → exact_spec.rb} +0 -0
- data/spec/unit/mutant/integration/rspec_spec.rb +2 -2
- data/spec/unit/mutant/integration_spec.rb +14 -0
- data/spec/unit/mutant/isolation/fork_spec.rb +155 -0
- data/spec/unit/mutant/isolation/none_spec.rb +16 -0
- data/spec/unit/mutant/loader_spec.rb +1 -1
- data/spec/unit/mutant/matcher/methods/instance_spec.rb +2 -4
- data/spec/unit/mutant/meta/example/dsl_spec.rb +106 -0
- data/spec/unit/mutant/meta/example/verification_spec.rb +120 -0
- data/spec/unit/mutant/meta/example_spec.rb +32 -0
- data/spec/unit/mutant/mutator/node_spec.rb +37 -4
- data/spec/unit/mutant/mutator_spec.rb +21 -0
- data/spec/unit/mutant/{runner → parallel}/driver_spec.rb +0 -0
- data/spec/unit/mutant/parallel/master_spec.rb +13 -13
- data/spec/unit/mutant/registry_spec.rb +47 -0
- data/spec/unit/mutant/reporter/cli/printer/config_spec.rb +0 -4
- data/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb +0 -8
- data/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +0 -2
- data/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb +0 -8
- data/spec/unit/mutant/reporter/cli/printer/status_spec.rb +0 -34
- data/spec/unit/mutant/reporter/cli_spec.rb +0 -22
- data/spec/unit/mutant/repository/diff_spec.rb +6 -6
- data/spec/unit/mutant/require_highjack_spec.rb +38 -14
- data/spec/unit/mutant/result/env_spec.rb +1 -4
- data/spec/unit/mutant/runner_spec.rb +1 -1
- data/spec/unit/mutant/subject/method/instance_spec.rb +1 -1
- data/spec/unit/mutant/subject_spec.rb +3 -3
- data/spec/unit/mutant/util/one_spec.rb +20 -0
- data/spec/unit/mutant/zombifier_spec.rb +18 -18
- data/test_app/{Gemfile.rspec3.3 → Gemfile.rspec3.5} +2 -2
- metadata +94 -24
- data/TODO +0 -21
- data/lib/mutant/mutator/node/blockarg.rb +0 -13
- data/lib/mutant/mutator/node/restarg.rb +0 -13
- data/lib/mutant/mutator/registry.rb +0 -49
- data/meta/boolean.rb +0 -13
- data/meta/regex.rb +0 -19
- data/spec/unit/mutant/isolation_spec.rb +0 -104
- data/spec/unit/mutant/mutator/registry_spec.rb +0 -57
@@ -0,0 +1,23 @@
|
|
1
|
+
module Mutant
|
2
|
+
class Mutator
|
3
|
+
class Node
|
4
|
+
class Send
|
5
|
+
class Conditional < self
|
6
|
+
|
7
|
+
handle(:csend)
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
# Emit mutations
|
12
|
+
#
|
13
|
+
# @return [undefined]
|
14
|
+
def dispatch
|
15
|
+
super()
|
16
|
+
emit(s(:send, *children))
|
17
|
+
end
|
18
|
+
|
19
|
+
end # Conditional
|
20
|
+
end # Send
|
21
|
+
end # Node
|
22
|
+
end # Mutator
|
23
|
+
end # Mutant
|
data/lib/mutant/mutator/util.rb
CHANGED
@@ -2,36 +2,6 @@ module Mutant
|
|
2
2
|
class Mutator
|
3
3
|
# Namespace for utility mutators
|
4
4
|
class Util < self
|
5
|
-
|
6
|
-
# Run utility mutator
|
7
|
-
#
|
8
|
-
# @param [Object] object
|
9
|
-
# @param [Object] parent
|
10
|
-
#
|
11
|
-
# @return [Enumerator<Object>]
|
12
|
-
# if no block given
|
13
|
-
#
|
14
|
-
# @return [self]
|
15
|
-
# otherwise
|
16
|
-
def self.each(object, parent, &block)
|
17
|
-
return to_enum(__method__, object, parent) unless block_given?
|
18
|
-
|
19
|
-
new(object, parent, block)
|
20
|
-
|
21
|
-
self
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
# Test if mutation is new
|
27
|
-
#
|
28
|
-
# @param [Object] generated
|
29
|
-
#
|
30
|
-
# @return [Boolean]
|
31
|
-
def new?(generated)
|
32
|
-
!input.eql?(generated)
|
33
|
-
end
|
34
|
-
|
35
5
|
end # Util
|
36
6
|
end # Mutator
|
37
7
|
end # Mutant
|
@@ -33,7 +33,7 @@ module Mutant
|
|
33
33
|
# @return [undefined]
|
34
34
|
def dispatch
|
35
35
|
input.each_with_index do |element, index|
|
36
|
-
Mutator.
|
36
|
+
Mutator.mutate(element).each do |mutation|
|
37
37
|
dup = dup_input
|
38
38
|
dup[index] = mutation
|
39
39
|
emit(dup)
|
@@ -42,19 +42,7 @@ module Mutant
|
|
42
42
|
end
|
43
43
|
|
44
44
|
end # Element
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
# Emit mutations
|
49
|
-
#
|
50
|
-
# @return [undefined]
|
51
|
-
def dispatch
|
52
|
-
run(Element)
|
53
|
-
run(Presence)
|
54
|
-
emit(EMPTY_ARRAY)
|
55
|
-
end
|
56
|
-
|
57
45
|
end # Array
|
58
|
-
end #
|
59
|
-
end #
|
60
|
-
end #
|
46
|
+
end # Util
|
47
|
+
end # Mutator
|
48
|
+
end # Mutant
|
data/lib/mutant/parallel.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
module Mutant
|
2
|
+
# Registry for mapping AST types to classes
|
3
|
+
class Registry
|
4
|
+
include Concord.new(:contents)
|
5
|
+
|
6
|
+
# Initialize object
|
7
|
+
#
|
8
|
+
# @return [undefined]
|
9
|
+
def initialize
|
10
|
+
super({})
|
11
|
+
end
|
12
|
+
|
13
|
+
# Raised when the type is an invalid type
|
14
|
+
RegistryError = Class.new(TypeError)
|
15
|
+
|
16
|
+
# Register class for AST node class
|
17
|
+
#
|
18
|
+
# @param [Symbol] type
|
19
|
+
# @param [Class] class
|
20
|
+
#
|
21
|
+
# @return [self]
|
22
|
+
def register(type, klass)
|
23
|
+
fail RegistryError, "Invalid type registration: #{type.inspect}" unless AST::Types::ALL.include?(type)
|
24
|
+
fail RegistryError, "Duplicate type registration: #{type.inspect}" if contents.key?(type)
|
25
|
+
contents[type] = klass
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
# Lookup class for node
|
30
|
+
#
|
31
|
+
# @param [Symbol] type
|
32
|
+
#
|
33
|
+
# @return [Class]
|
34
|
+
#
|
35
|
+
# @raise [ArgumentError]
|
36
|
+
# raises argument error when class cannot be found
|
37
|
+
def lookup(type)
|
38
|
+
contents.fetch(type) do
|
39
|
+
fail RegistryError, "No entry for: #{type.inspect}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end # Registry
|
44
|
+
end # Mutant
|
@@ -75,14 +75,14 @@ module Mutant
|
|
75
75
|
#
|
76
76
|
# @return [undefined]
|
77
77
|
def info(string, *arguments)
|
78
|
-
puts(
|
78
|
+
puts(string % arguments)
|
79
79
|
end
|
80
80
|
|
81
81
|
# Print a status line to output
|
82
82
|
#
|
83
83
|
# @return [undefined]
|
84
84
|
def status(string, *arguments)
|
85
|
-
puts(colorize(status_color,
|
85
|
+
puts(colorize(status_color, string % arguments))
|
86
86
|
end
|
87
87
|
|
88
88
|
# Print a line to output
|
@@ -14,7 +14,6 @@ module Mutant
|
|
14
14
|
info 'Mutant configuration:'
|
15
15
|
info 'Matcher: %s', object.matcher.inspect
|
16
16
|
info 'Integration: %s', object.integration
|
17
|
-
info 'Expect Coverage: %0.2f%%', (object.expected_coverage * 100)
|
18
17
|
info 'Jobs: %d', object.jobs
|
19
18
|
info 'Includes: %s', object.includes
|
20
19
|
info 'Requires: %s', object.requires
|
@@ -28,8 +28,7 @@ module Mutant
|
|
28
28
|
[:info, 'Killtime: %0.2fs', :killtime ],
|
29
29
|
[:info, 'Overhead: %0.2f%%', :overhead_percent ],
|
30
30
|
[:info, 'Mutations/s: %0.2f', :mutations_per_second ],
|
31
|
-
[:status, 'Coverage: %0.2f%%', :coverage_percent ]
|
32
|
-
[:status, 'Expected: %0.2f%%', :expected_coverage_percent]
|
31
|
+
[:status, 'Coverage: %0.2f%%', :coverage_percent ]
|
33
32
|
])
|
34
33
|
|
35
34
|
# Run printer
|
@@ -62,15 +61,6 @@ module Mutant
|
|
62
61
|
coverage * 100
|
63
62
|
end
|
64
63
|
|
65
|
-
# Expected coverage in percent
|
66
|
-
#
|
67
|
-
# @return [Float]
|
68
|
-
#
|
69
|
-
# @api private
|
70
|
-
def expected_coverage_percent
|
71
|
-
env.config.expected_coverage * 100
|
72
|
-
end
|
73
|
-
|
74
64
|
# Overhead in percent
|
75
65
|
#
|
76
66
|
# @return [Float]
|
@@ -10,10 +10,14 @@ module Mutant
|
|
10
10
|
# @return [#call]
|
11
11
|
# the original implementation on singleton
|
12
12
|
def self.call(target, callback)
|
13
|
-
target.
|
13
|
+
target.public_method(:require).tap do
|
14
14
|
target.module_eval do
|
15
|
+
undef_method(:require)
|
15
16
|
define_method(:require, &callback)
|
16
|
-
|
17
|
+
class << self
|
18
|
+
undef_method(:require)
|
19
|
+
end
|
20
|
+
define_singleton_method(:require, &callback)
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
data/lib/mutant/result.rb
CHANGED
data/lib/mutant/subject.rb
CHANGED
@@ -9,11 +9,11 @@ module Mutant
|
|
9
9
|
# @return [Enumerable<Mutation>]
|
10
10
|
# @return [undefined]
|
11
11
|
def mutations
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
[neutral_mutation].concat(
|
13
|
+
Mutator.mutate(node).map do |mutant|
|
14
|
+
Mutation::Evil.new(self, wrap_node(mutant))
|
15
|
+
end
|
16
|
+
)
|
17
17
|
end
|
18
18
|
memoize :mutations
|
19
19
|
|
data/lib/mutant/util.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Mutant
|
2
|
+
# Utility methods
|
3
|
+
module Util
|
4
|
+
# Error raised by `Util.one` if size is less than zero or greater than one
|
5
|
+
SizeError = Class.new(IndexError)
|
6
|
+
|
7
|
+
# Return only element in array if it contains exactly one member
|
8
|
+
#
|
9
|
+
# @param array [Array]
|
10
|
+
#
|
11
|
+
# @return [Object] first entry
|
12
|
+
def self.one(array)
|
13
|
+
return array.first if array.one?
|
14
|
+
|
15
|
+
fail SizeError, "expected size to be exactly 1 but size was #{array.size}"
|
16
|
+
end
|
17
|
+
end # Util
|
18
|
+
end # Mutant
|
data/lib/mutant/version.rb
CHANGED
data/lib/mutant/zombifier.rb
CHANGED
@@ -57,13 +57,15 @@ module Mutant
|
|
57
57
|
#
|
58
58
|
# @param [#to_s] logical_name
|
59
59
|
#
|
60
|
-
# @return [
|
60
|
+
# @return [Bool]
|
61
|
+
# true if successful and false if feature already loaded
|
61
62
|
def require(logical_name)
|
62
63
|
logical_name = logical_name.to_s
|
63
|
-
@original.call(logical_name)
|
64
|
-
return unless include?(logical_name)
|
64
|
+
loaded = @original.call(logical_name)
|
65
|
+
return loaded unless include?(logical_name)
|
65
66
|
@zombified << logical_name
|
66
67
|
zombify(find(logical_name))
|
68
|
+
true
|
67
69
|
end
|
68
70
|
|
69
71
|
# Find file by logical path
|
data/meta/and.rb
CHANGED
data/meta/and_asgn.rb
CHANGED
data/meta/array.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Mutant::Meta::Example.add do
|
1
|
+
Mutant::Meta::Example.add :array do
|
2
2
|
source '[true]'
|
3
3
|
|
4
4
|
singleton_mutations
|
@@ -8,7 +8,7 @@ Mutant::Meta::Example.add do
|
|
8
8
|
mutation '[]'
|
9
9
|
end
|
10
10
|
|
11
|
-
Mutant::Meta::Example.add do
|
11
|
+
Mutant::Meta::Example.add :array do
|
12
12
|
source '[true, false]'
|
13
13
|
|
14
14
|
singleton_mutations
|
data/meta/begin.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Mutant::Meta::Example.add do
|
1
|
+
Mutant::Meta::Example.add :begin do
|
2
2
|
|
3
3
|
source 'true; false'
|
4
4
|
# Mutation of each statement in block
|
@@ -12,7 +12,7 @@ Mutant::Meta::Example.add do
|
|
12
12
|
mutation 'false'
|
13
13
|
end
|
14
14
|
|
15
|
-
Mutant::Meta::Example.add do
|
15
|
+
Mutant::Meta::Example.add :begin do
|
16
16
|
|
17
17
|
source s(:begin, s(:true))
|
18
18
|
# Mutation of each statement in block
|