Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (19 sloc) 0.844 kb
(ns kibit.test.control-structures
(:require [kibit.check :as kibit])
(:use [clojure.test]))
(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"))
'(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)
'(let [a 1] (println a) a) '(let [a 1] (do (println a) a))))
Jump to Line
Something went wrong with that request. Please try again.