Skip to content

Commit cc665bb

Browse files
oakmaccburgmer
authored andcommitted
add test for Filter expression with value true
1 parent cc12380 commit cc665bb

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

test/json_path/test/json_path_test.clj

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,31 @@
5858
keys-of-many-types) => [{:key 1}, {:key 3}]
5959
;; Filter expression with boolean or operator and value true
6060
(at-path "$[?(@.key>0 || true)]"
61-
keys-of-many-types) => keys-of-many-types)
61+
keys-of-many-types) => keys-of-many-types
62+
;; Filter expression with value true
63+
(at-path "$[?(@.key)]"
64+
[{:some "some value"}
65+
{:key true}
66+
{:key false}
67+
{:key nil}
68+
{:key "value"}
69+
{:key ""}
70+
{:key 0}
71+
{:key 1}
72+
{:key -1}
73+
{:key 42}
74+
{:key {}}
75+
{:key []}])
76+
=> [{:key true}
77+
{:key false}
78+
{:key "value"}
79+
{:key ""}
80+
{:key 0}
81+
{:key 1}
82+
{:key -1}
83+
{:key 42}
84+
{:key {}}
85+
{:key []}])
6286
;; TODO: Filter expression with different grouped operators
6387
;; NOTE: the parser will need to be updated in order to get this test to work
6488
; (at-path "$[?(@.a && (@.b || @.c))]"

0 commit comments

Comments
 (0)