mutant 0.10.11 → 0.10.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mutant/cli/command/environment.rb +2 -2
- data/lib/mutant/license.rb +2 -2
- data/lib/mutant/meta.rb +1 -2
- data/lib/mutant/meta/example.rb +20 -2
- data/lib/mutant/meta/example/dsl.rb +11 -10
- data/lib/mutant/meta/example/verification.rb +2 -2
- data/lib/mutant/mutation.rb +16 -20
- data/lib/mutant/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c573735f4e77ea0dd9313412e82bbca47771e8fd379c5d53393e855248b7792
|
4
|
+
data.tar.gz: 7c59c273789c9fb3d85dd858a7ed7d6bec85b8440ad05736f70541325d214947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff3a349908f6f3f83ace0ce4de9555b981f6a82515954e635a7539b2d8852d9bfa740a2c33afd2b3b49a34e0358920be9d0c22b8c05c2903356d75b9c4a4ccc6
|
7
|
+
data.tar.gz: 2b3cc3f947b50bc407c8c5a3239ad5bbddf2ff2adc773e661f8279d650297accaad05cdcdbce5e64ae04e419dd63740e0de493542f44464bb5d7d7ee60ab37c1
|
@@ -19,7 +19,7 @@ module Mutant
|
|
19
19
|
|
20
20
|
def initialize(attributes)
|
21
21
|
super(attributes)
|
22
|
-
@config = Config
|
22
|
+
@config = Config::DEFAULT
|
23
23
|
end
|
24
24
|
|
25
25
|
def bootstrap
|
@@ -29,7 +29,7 @@ module Mutant
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def expand(file_config)
|
32
|
-
@config = file_config.merge(@config)
|
32
|
+
@config = Config.env.merge(file_config).merge(@config)
|
33
33
|
end
|
34
34
|
|
35
35
|
def parse_remaining_arguments(arguments)
|
data/lib/mutant/license.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Mutant
|
4
4
|
module License
|
5
5
|
NAME = 'mutant-license'
|
6
|
-
VERSION = '
|
6
|
+
VERSION = ['>= 0.1', '< 0.3'].freeze
|
7
7
|
|
8
8
|
# Load license
|
9
9
|
#
|
@@ -20,7 +20,7 @@ module Mutant
|
|
20
20
|
|
21
21
|
def self.load_mutant_license(world)
|
22
22
|
Either
|
23
|
-
.wrap_error(LoadError) { world.gem_method.call(NAME, VERSION) }
|
23
|
+
.wrap_error(LoadError) { world.gem_method.call(NAME, *VERSION) }
|
24
24
|
.lmap(&:message)
|
25
25
|
.lmap(&method(:check_for_rubygems_mutant_license))
|
26
26
|
end
|
data/lib/mutant/meta.rb
CHANGED
@@ -17,8 +17,7 @@ module Mutant
|
|
17
17
|
#
|
18
18
|
# @return [undefined]
|
19
19
|
def self.add(*types, &block)
|
20
|
-
|
21
|
-
ALL << DSL.call(file, Set.new(types), block)
|
20
|
+
ALL << DSL.call(caller_locations(1).first, Set.new(types), block)
|
22
21
|
end
|
23
22
|
|
24
23
|
Pathname.glob(Pathname.new(__dir__).parent.parent.join('meta', '*.rb'))
|
data/lib/mutant/meta/example.rb
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
module Mutant
|
4
4
|
module Meta
|
5
5
|
class Example
|
6
|
-
include Adamantium
|
6
|
+
include Adamantium::Flat
|
7
|
+
|
7
8
|
include Anima.new(
|
8
9
|
:expected,
|
9
|
-
:
|
10
|
+
:location,
|
10
11
|
:lvars,
|
11
12
|
:node,
|
12
13
|
:original_source,
|
@@ -25,6 +26,23 @@ module Mutant
|
|
25
26
|
end
|
26
27
|
memoize :verification
|
27
28
|
|
29
|
+
# Example identification
|
30
|
+
#
|
31
|
+
# @return [String]
|
32
|
+
def identification
|
33
|
+
location.to_s
|
34
|
+
end
|
35
|
+
|
36
|
+
# Context of mutation
|
37
|
+
#
|
38
|
+
# @return [Context]
|
39
|
+
def context
|
40
|
+
Context.new(
|
41
|
+
Object,
|
42
|
+
location.path
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
28
46
|
# Original source as generated by unparser
|
29
47
|
#
|
30
48
|
# @return [String]
|
@@ -9,12 +9,12 @@ module Mutant
|
|
9
9
|
|
10
10
|
# Run DSL on block
|
11
11
|
#
|
12
|
-
# @param [
|
12
|
+
# @param [Thread::Backtrace::Location] location
|
13
13
|
# @param [Set<Symbol>] types
|
14
14
|
#
|
15
15
|
# @return [Example]
|
16
|
-
def self.call(
|
17
|
-
instance = new(
|
16
|
+
def self.call(location, types, block)
|
17
|
+
instance = new(location, types)
|
18
18
|
instance.instance_eval(&block)
|
19
19
|
instance.example
|
20
20
|
end
|
@@ -24,12 +24,12 @@ module Mutant
|
|
24
24
|
# Initialize object
|
25
25
|
#
|
26
26
|
# @return [undefined]
|
27
|
-
def initialize(
|
28
|
-
@expected
|
29
|
-
@
|
30
|
-
@lvars
|
31
|
-
@source
|
32
|
-
@types
|
27
|
+
def initialize(location, types)
|
28
|
+
@expected = []
|
29
|
+
@location = location
|
30
|
+
@lvars = []
|
31
|
+
@source = nil
|
32
|
+
@types = types
|
33
33
|
end
|
34
34
|
|
35
35
|
# Example captured by DSL
|
@@ -40,9 +40,10 @@ module Mutant
|
|
40
40
|
# in case example cannot be build
|
41
41
|
def example
|
42
42
|
fail 'source not defined' unless @source
|
43
|
+
|
43
44
|
Example.new(
|
44
45
|
expected: @expected,
|
45
|
-
|
46
|
+
location: @location,
|
46
47
|
lvars: @lvars,
|
47
48
|
node: @node,
|
48
49
|
original_source: @source,
|
@@ -28,7 +28,7 @@ module Mutant
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def reports
|
31
|
-
reports = [example.
|
31
|
+
reports = [example.location]
|
32
32
|
reports.concat(original)
|
33
33
|
reports.concat(original_verification)
|
34
34
|
reports.concat(make_report('Missing mutations:', missing))
|
@@ -94,7 +94,7 @@ module Mutant
|
|
94
94
|
|
95
95
|
def missing
|
96
96
|
(example.expected.map(&:node) - mutations.map(&:node)).map do |node|
|
97
|
-
Mutation::Evil.new(
|
97
|
+
Mutation::Evil.new(example, node)
|
98
98
|
end
|
99
99
|
end
|
100
100
|
memoize :missing
|
data/lib/mutant/mutation.rb
CHANGED
@@ -9,37 +9,34 @@ module Mutant
|
|
9
9
|
CODE_DELIMITER = "\0"
|
10
10
|
CODE_RANGE = (0..4).freeze
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
def initialize(subject, node)
|
13
|
+
super(subject, node)
|
14
|
+
|
15
|
+
@source = Unparser.unparse(node)
|
16
|
+
@code = sha1[CODE_RANGE]
|
17
|
+
@identification = "#{self.class::SYMBOL}:#{subject.identification}:#{code}"
|
18
|
+
@monkeypatch = Unparser.unparse(subject.context.root(node))
|
17
19
|
end
|
18
|
-
memoize :identification
|
19
20
|
|
20
|
-
# Mutation code
|
21
|
+
# Mutation identification code
|
21
22
|
#
|
22
23
|
# @return [String]
|
23
|
-
|
24
|
-
sha1[CODE_RANGE]
|
25
|
-
end
|
26
|
-
memoize :code
|
24
|
+
attr_reader :code
|
27
25
|
|
28
26
|
# Normalized mutation source
|
29
27
|
#
|
30
28
|
# @return [String]
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
attr_reader :source
|
30
|
+
|
31
|
+
# Identification string
|
32
|
+
#
|
33
|
+
# @return [String]
|
34
|
+
attr_reader :identification
|
35
35
|
|
36
36
|
# The monkeypatch to insert the mutation
|
37
37
|
#
|
38
38
|
# @return [String]
|
39
|
-
|
40
|
-
Unparser.unparse(subject.context.root(node))
|
41
|
-
end
|
42
|
-
memoize :monkeypatch
|
39
|
+
attr_reader :monkeypatch
|
43
40
|
|
44
41
|
# Normalized original source
|
45
42
|
#
|
@@ -77,7 +74,6 @@ module Mutant
|
|
77
74
|
def sha1
|
78
75
|
Digest::SHA1.hexdigest(subject.identification + CODE_DELIMITER + source)
|
79
76
|
end
|
80
|
-
memoize :sha1
|
81
77
|
|
82
78
|
# Evil mutation that should case mutations to fail tests
|
83
79
|
class Evil < self
|
data/lib/mutant/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: abstract_type
|