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:
parent
75b4091ebb
commit
3b5cac7c86
1 changed files with 10 additions and 3 deletions
|
@ -13,8 +13,15 @@
|
||||||
(deftest control-structures-are
|
(deftest control-structures-are
|
||||||
(are [expected-alt-form test-form]
|
(are [expected-alt-form test-form]
|
||||||
(= expected-alt-form (:alt (kibit/check-expr 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") nil)
|
||||||
'(println "X") '(if true (println "X"))
|
'(println "X") '(if true (println "X"))
|
||||||
'(when-not test else) '(if test nil else)
|
'(do body-1 body-2) '(when true body-1 body-2)
|
||||||
'(when test then) '(if test then nil)))
|
'single-expression '(do single-expression)
|
||||||
|
'_ '(when-not true anything)
|
||||||
|
'_ '(when false anything)
|
||||||
|
'(when-let [a test] expr) '(if-let [a test] expr nil)))
|
||||||
|
|
Loading…
Reference in a new issue