Github user justinleet commented on a diff in the pull request:

    https://github.com/apache/metron/pull/606#discussion_r119832707
  
    --- Diff: 
metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/StellarTest.java
 ---
    @@ -634,6 +679,40 @@ public void testLogicalFunctions() throws Exception {
         Assert.assertTrue(runPredicate("not(IN_SUBNET(ip_dst_addr, 
'192.168.0.0/24'))", v-> variableMap.get(v)));
       }
     
    +  @Test
    +  public void testShortCircuit_conditional() throws Exception {
    +    Assert.assertEquals("foo", run("if true then 'foo' else 
THROW('expression')", new HashMap<>()));
    +    Assert.assertEquals("foo", run("true ? 'foo' : THROW('expression')", 
new HashMap<>()));
    +    Assert.assertEquals("foo", run("if false then THROW('exception') else 
'foo'", new HashMap<>()));
    +    Assert.assertEquals("foo", run("false ? THROW('exception') : 'foo'", 
new HashMap<>()));
    +    Assert.assertEquals(true, run("RET_TRUE(if true then 'foo' else 
THROW('expression'))", new HashMap<>()));
    +    Assert.assertEquals("foo", run("if true or (true or THROW('if 
exception')) then 'foo' else THROW('expression')", new HashMap<>()));
    +    Assert.assertEquals("foo", run("if true or (false or THROW('if 
exception')) then 'foo' else THROW('expression')", new HashMap<>()));
    +    Assert.assertEquals("foo", run("if NOT(true or (false or THROW('if 
exception'))) then THROW('expression') else 'foo'", new HashMap<>()));
    +    Assert.assertEquals("foo", run("if NOT('metron' in [ 'metron', 
'metronicus'] ) then THROW('expression') else 'foo'", new HashMap<>()));
    +  }
    +
    +  @Test
    +  public void testShortCircuit_boolean() throws Exception {
    +    Assert.assertTrue(runPredicate("'metron' in ['metron', 'metronicus', 
'mortron'] or (true or THROW('exception'))", x -> null));
    --- End diff --
    
    Adding a case like:
    `Assert.assertTrue(runPredicate("NOT(true) or THROW('exception'))", x -> 
null));` doesn't parse and I would expect it to.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to