Add example for complex composition of predicate on matching

This commit is contained in:
Markus Schirp 2014-07-13 20:02:30 +00:00
parent f4da9c6b11
commit 8b2b43919a

View file

@ -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