Add example for complex composition of predicate on matching
This commit is contained in:
parent
f4da9c6b11
commit
8b2b43919a
1 changed files with 27 additions and 0 deletions
|
@ -82,6 +82,33 @@ describe Mutant::Matcher::Compiler do
|
|||
|
||||
it { should eql(expected_matcher) }
|
||||
end
|
||||
|
||||
context 'and subject and attribute filter' do
|
||||
let(:attributes) do
|
||||
{
|
||||
match_expressions: [expression_a],
|
||||
subject_ignores: [expression_b],
|
||||
subject_selects: [[:code, 'foo']]
|
||||
}
|
||||
end
|
||||
|
||||
let(:expected_positive_matcher) { Mutant::Matcher::Chain.new([matcher_a]) }
|
||||
|
||||
let(:expected_predicate) do
|
||||
Morpher::Evaluator::Predicate::Boolean::And.new([
|
||||
Morpher::Evaluator::Predicate::Boolean::Or.new([
|
||||
Morpher.compile(s(:eql, s(:attribute, :code), s(:static, 'foo')))
|
||||
]),
|
||||
Morpher::Evaluator::Predicate::Negation.new(
|
||||
Morpher::Evaluator::Predicate::Boolean::Or.new([
|
||||
described_class::SubjectPrefix.new(expression_b)
|
||||
])
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it { should eql(expected_matcher) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'on config with multiple match expressions' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue