Skip to content

Commit

Permalink
fix to MVEL interpreter edge case with contains operator with compoun…
Browse files Browse the repository at this point in the history
…d expression on RHS.
  • Loading branch information
mikebrock committed Jan 22, 2013
1 parent 7bf9dbb commit 86ee3a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/mvel2/compiler/AbstractParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@ else if (((NewObjectNode) lastNode).getTypeDescr().isUndimensionedArray()) {
}

return (ASTNode) splitAccumulator.pop();

case CONTAINS:
lastWasIdentifier = false;
return lastNode = new OperatorNode(Operator.CONTAINS, expr, st, pCtx);

}
}

Expand Down
3 changes: 3 additions & 0 deletions src/test/java/org/mvel2/tests/core/ComparisonTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ public void testContains6() {
assertEquals(true, test("bwahbwah = 'mikebrock'; testVar10 = 'mike'; bwahbwah contains testVar10"));
}

public void testContains7() {
assertEquals(true, test("sentence contains ('fox')"));
}

public void testSoundex() {
assertTrue((Boolean) test("'foobar' soundslike 'fubar'"));
Expand Down

0 comments on commit 86ee3a3

Please sign in to comment.