This repository was archived by the owner on Oct 31, 2024. It is now read-only.
File tree 3 files changed +17
-1
lines changed
antlr4/io/burt/jmespath/parser
java/io/burt/jmespath/node
test/java/io/burt/jmespath/parser
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ expression
6
6
: expression ' .' chainedExpression # chainExpression
7
7
| expression bracketSpecifier # bracketedExpression
8
8
| bracketSpecifier # bracketExpression
9
- | expression COMPARATOR expression # comparisonExpression
10
9
| ' !' expression # notExpression
10
+ | expression COMPARATOR expression # comparisonExpression
11
11
| expression ' &&' expression # andExpression
12
12
| expression ' ||' expression # orExpression
13
13
| identifier # identifierExpression
Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ protected boolean internalEquals(Object o) {
22
22
return negated .equals (other .negated );
23
23
}
24
24
25
+ @ Override
26
+ protected String internalToString () {
27
+ return negated .toString ();
28
+ }
29
+
25
30
@ Override
26
31
protected int internalHashCode () {
27
32
return 17 + 31 * negated .hashCode ();
Original file line number Diff line number Diff line change @@ -843,6 +843,17 @@ public void negatedSelectionExpression() {
843
843
assertThat (actual , is (expected ));
844
844
}
845
845
846
+ @ Test
847
+ public void negatedComparison () {
848
+ Expression <Object > expected = Comparison (
849
+ "==" ,
850
+ Negate (Property ("foo" )),
851
+ JsonLiteral ("false" )
852
+ );
853
+ Expression <Object > actual = compile ("!foo == `false`" );
854
+ assertThat (actual , is (expected ));
855
+ }
856
+
846
857
@ Test
847
858
public void bareJsonLiteralExpression () {
848
859
Expression <Object > expected = JsonLiteral ("{}" );
You can’t perform that action at this time.
0 commit comments