Class: Mutant::Config::Selection Private
- Inherits:
-
Object
- Object
- Mutant::Config::Selection
- Includes:
- Unparser::Adamantium
- Defined in:
- lib/mutant/config/selection.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Configuration of how tests get selected for a subject
Constant Summary collapse
- AUTO =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Use the coverage recording when there is one, and the expressions otherwise. Mutant's default.
'auto'- EXPRESSION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Select tests whose expressions match the subject's
'expression'- CONTEXT_MAP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Select tests a coverage recording says executed the subject's lines
'context_map'- STRATEGIES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[AUTO, EXPRESSION, CONTEXT_MAP].freeze
- DEFAULT_PATH =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Directory coverage tools write their report into
'coverage'- DEFAULT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Both attributes stay nil until set, so a value from mutant.yml is not overwritten by a default coming from the CLI end of the merge.
new(path: nil, strategy: nil)
- TRANSFORM =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Transform::Sequence.new( steps: [ Transform::Hash.new( optional: [ Transform::Hash::Key.new( transform: Transform::STRING, value: 'path' ), Transform::Hash::Key.new( transform: Transform::STRING, value: 'strategy' ) ], required: [] ), Transform::Hash::Symbolize.new, Transform::Block.capture(:selection) { |value| new(**DEFAULT.to_h, **value).validate } ] )
Instance Method Summary collapse
-
#context_map? ⇒ Boolean
private
Whether the recording is the only acceptable source of tests.
-
#effective_path ⇒ String
private
The configured recording location, or the conventional one.
-
#expression? ⇒ Boolean
private
Whether the expressions are the only acceptable source of tests.
-
#merge(other) ⇒ Selection
private
Merge with other selection config.
-
#validate ⇒ Either<String, Selection>
private
Reject a strategy mutant does not implement.
Instance Method Details
#context_map? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether the recording is the only acceptable source of tests
56 |
# File 'lib/mutant/config/selection.rb', line 56 def context_map? = strategy.eql?(CONTEXT_MAP) |
#effective_path ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The configured recording location, or the conventional one
66 |
# File 'lib/mutant/config/selection.rb', line 66 def effective_path = path || DEFAULT_PATH |
#expression? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether the expressions are the only acceptable source of tests
61 |
# File 'lib/mutant/config/selection.rb', line 61 def expression? = strategy.eql?(EXPRESSION) |
#merge(other) ⇒ Selection
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Merge with other selection config
Values from the other instance have precedence.
84 85 86 87 88 89 |
# File 'lib/mutant/config/selection.rb', line 84 def merge(other) self.class.new( path: other.path || path, strategy: other.strategy || strategy ) end |
#validate ⇒ Either<String, Selection>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reject a strategy mutant does not implement
71 72 73 74 75 |
# File 'lib/mutant/config/selection.rb', line 71 def validate return Either::Right.new(self) if strategy.nil? || STRATEGIES.include?(strategy) Either::Left.new(UNKNOWN_STRATEGY % [strategy.inspect, STRATEGIES.join(', ')]) end |