Copilot commented on code in PR #7262:
URL: https://github.com/apache/incubator-kie/pull/7262#discussion_r4466987888
##########
drools-model/drools-model-compiler/src/test/java/org/drools/modelcompiler/PatternDSLSequenceConsequenceTest.java:
##########
@@ -449,4 +449,99 @@ public void stepVariableResolvedWhenLhsHasFirstLevelOr() {
assertThat(results).containsExactly("ball+go");
}
+
+ @Test
+ public void namedConsequenceBetweenTwoSequencesResolvesStepVariable() {
+ Variable<Person> personV = declarationOf(Person.class);
+ Variable<Toy> toyV = declarationOf(Toy.class);
+ Variable<Relationship> relV = declarationOf(Relationship.class);
+
+ Rule rule = rule("named-consequence-between-sequences").build(
+ pattern(personV),
+ sequence(
+ pattern(toyV).expr("is-ball", t ->
t.getName().equals("ball"))
+ ),
+ when("always", personV, p -> true).then(
+ on(toyV).breaking().execute(t -> results.add("named:"
+ t.getName()))
+ ),
Review Comment:
All three new regressions use `when(...).then(...)`, which goes through
`buildConditionalConsequence`, so none exercises the new sequence-count
registration in the plain `NamedConsequenceImpl` branch. Please add a case with
a direct `on(toyV).execute(...)` between the sequences, or use that form here.
Otherwise, removing the plain-consequence registration would leave these tests
passing while reintroducing the anchor-skip failure for unconditional named
consequences.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]