我正在为我的第一个Clojure项目编写测试用例。在这里,如果“:meat”的值为空,我希望测试失败:
(deftest order-sandwich
(let [response {:meat "" :bread "yes" :add-on "lettuce"}]
(is (= (:bread response) "yes"))
(is (not (nil? (:meat response))))))
Run Code Online (Sandbox Code Playgroud)
但是我的测试运行成功(返回“ nil”)。
有人知道为什么会这样吗?有一个更好的方法吗?
我提前谢谢你!!
我需要过滤给定的向量,使输出只包含那些不是直接邻居的副本的元素.
Example : I/P -> [1 1 3 2 2 4 5 5]
O/P -> [3 4]
Run Code Online (Sandbox Code Playgroud)