yurloc commented on code in PR #5884:
URL: 
https://github.com/apache/incubator-kie-drools/pull/5884#discussion_r1590787019


##########
drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/MiscDRLParserTest.java:
##########
@@ -4090,6 +4092,28 @@ void ooPathMixedWithStandardConstraint() {
                 .isEqualToIgnoringWhitespace("/wife[$age : age] && age > 
$age");
     }
 
+    @Test
+    void ooPathLhsPattern() {
+        final String text = "package org.drools\n"
+                + "rule PlainNot when\n"
+                + "    not( /strings [ this == \"It Does Work\" ] )\n"
+                + "then\n"
+                + "end\n";
+        PackageDescr packageDescr = parseAndGetPackageDescr(text);
+        RuleDescr ruleDescr = packageDescr.getRules().get(0);
+        
assertThat(ruleDescr.getLhs().getDescrs().get(0)).isInstanceOfSatisfying(NotDescr.class,
 notDescr -> {

Review Comment:
   > 2\. IINW, this test verify only the positive case (i.e. it must not 
fails): is there a "negative" test to verify the behavior in case of "wrong" 
situations  (this is a theoretical POV question, not sure if it make sense in 
that context) ?
   
   Not sure if I get your point 100% correctly but I would say a negative test 
is not applicable in this context. Yes, this is a positive test in the sense 
that given this specific input (`...not( /strings [ this == "It Does Work" ] 
)...`), the parser and the rule context visitor should produce this exact 
descriptor structure with these exact properties.
   
   Given that, a negative test would make assumptions about the parser output 
if the input is somehow incorrect or unexpected, right? But that's already 
covered:
   - If the input is wrong (erroneous), the parser should fail and we have 
tests for that[1].
   - If the input is correct but different (unexpected), then it's a different 
test case.
   
   [1] We have negative (parser error) tests for the expression parser but not 
for the general DRL parser, which I have found out thanks to your question. 
I'll file a ticket for that. Thanks!



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

Reply via email to