Merge branch 'check-form-tests'

This commit is contained in:
Paul deGrandis 2012-03-09 14:33:11 -05:00
commit ffbb0da9d2
3 changed files with 21 additions and 2 deletions

View file

@ -11,9 +11,13 @@
(filter (complement ?pred) ?coll) (remove ?pred ?coll)
(filter #(not (?pred ?x)) ?coll) (remove ?pred ?coll)
;; anonymous functions
(fn ?args (?fun . ?args)) ?fun
(fn* ?args (?fun . ?args)) ?fun
;;do
(do ?x) ?x
})
(comment

View file

@ -13,8 +13,9 @@
(deftest control-structures-are
(are [expected-alt-form test-form]
(= expected-alt-form (:alt (kibit/check-form test-form)))
'(println "X") '(if true (println "X") nil)
'(println "X") '(if true (println "X"))
; These two below require a recursive check-form
;'(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)))

14
test/kibit/test/core.clj Normal file
View file

@ -0,0 +1,14 @@
(ns kibit.test.core
(:require [jonase.kibit.core :as kibit])
(:use [clojure.test]))
(deftest check-form-alts
(are [expected-alt test-form]
(= expected-alt (:alt (kibit/check-form test-form)))
[1 2 3] '(do [1 2 3])
[] '(do [])
"Hello" '(do "Hello")
'(when test then) '(do (when test then))
:one '(do :one)
{:one 1} '(do {:one 1})))