More complete test coverage for control-structures

This covers all but the (loop [] ...) rule, which seems to include the
(recur) in the body of the suggested (when...) form.
This commit is contained in:
John Hume 2012-06-10 19:29:14 -04:00
parent 75b4091ebb
commit 3b5cac7c86

View file

@ -13,8 +13,15 @@
(deftest control-structures-are
(are [expected-alt-form test-form]
(= expected-alt-form (:alt (kibit/check-expr test-form)))
'(when test then) '(if test then nil)
'(when-not test else) '(if test nil else)
'(when test body) '(if test (do body))
'(if-not test then else) '(if (not test) then else)
'(when-not test then) '(when (not test) then)
'(println "X") '(if true (println "X") nil)
'(println "X") '(if true (println "X"))
'(when-not test else) '(if test nil else)
'(when test then) '(if test then nil)))
'(do body-1 body-2) '(when true body-1 body-2)
'single-expression '(do single-expression)
'_ '(when-not true anything)
'_ '(when false anything)
'(when-let [a test] expr) '(if-let [a test] expr nil)))