@@ -61,31 +61,22 @@ describe "js-ast-test", ->
6161 # Tags
6262 " tagged \" cat\" " : ' (event.tags.indexOf("cat") !== -1)'
6363
64- # # Boolean operators
65- # "not host = 1": (not (= (:host event) 1))
66- # "host = 1 and state = 2": (and (= (:host event) 1)
67- # (= (:state event) 2))
68- # "host = 1 or state = 2": (or (= (:host event) 1)
69- # (= (:state event) 2))
70-
71- # # Grouping
72- # "(host = 1)": (= (:host event) 1)
73- # "((host = 1))": (= (:host event) 1)
74-
75- # # Precedence
76- # "not host = 1 and host = 2": (and (not (= (:host event) 1))
77- # (= (:host event) 2))
78-
79- # "not host = 1 or host = 2 and host = 3":
80- # (or (not (= (:host event) 1))
81- # (and (= (:host event) 2) (= (:host event) 3)))
82-
83- # "not ((host = 1 or host = 2) and host = 3)":
84- # (not (and (or (= (:host event) 1)
85- # (= (:host event) 2))
86- # (= (:host event) 3)))
87- # ))
64+ # Boolean operators
65+ " not host = 1" : ' ( ! ( event["host"] == 1 ) )'
66+ " host = 1 and state = 2" : ' ( ( event["host"] == 1 ) && ( event["state"] == 2 ) )'
67+ " host = 1 or state = 2" : ' ( ( event["host"] == 1 ) || ( event["state"] == 2 ) )'
68+
69+ # Grouping
70+ " (host = 1)" : ' ( event["host"] == 1 )'
71+ " ((host = 1))" : ' ( event["host"] == 1 )'
72+
73+ # Precedence
74+ " not host = 1 and host = 2" : ' ( ( ! ( event["host"] == 1 ) ) && ( event["host"] == 2 ) )'
75+
76+ " not host = 1 or host = 2 and host = 3" : ' ( ( ! ( event["host"] == 1 ) ) || ( ( event["host"] == 2 ) && ( event["host"] == 3 ) ) )'
77+
78+ " not ((host = 1 or host = 2) and host = 3)" : ' ( ! ( ( ( event["host"] == 1 ) || ( event["host"] == 2 ) ) && ( event["host"] == 3 ) ) )'
8879
8980 for expression, expected of expressions
9081 compiled = (js_ast clj_ast ast expression)
91- expect (compiled).to .equal expected
82+ expect (compiled).to .equal expected
0 commit comments