Mercurial > lasercutter
view src/clojure/test_clojure/repl.clj @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
line wrap: on
line source
1 (ns clojure.test-clojure.repl2 (:use clojure.test3 clojure.repl4 clojure.test-clojure.repl.example))6 (deftest test-source7 (is (= "(defn foo [])" (source-fn 'clojure.test-clojure.repl.example/foo)))8 (is (= "(defn foo [])\n" (with-out-str (source clojure.test-clojure.repl.example/foo))))9 (is (nil? (source-fn 'non-existent-fn))))11 (deftest test-dir12 (is (thrown? Exception (dir-fn 'non-existent-ns)))13 (is (= '[bar foo] (dir-fn 'clojure.test-clojure.repl.example)))14 (is (= "bar\nfoo\n" (with-out-str (dir clojure.test-clojure.repl.example)))))16 (deftest test-apropos17 (testing "with a regular expression"18 (is (= '[defmacro] (apropos #"^defmacro$")))19 (is (some #{'defmacro} (apropos #"def.acr.")))20 (is (= [] (apropos #"nothing-has-this-name"))))22 (testing "with a string"23 (is (some #{'defmacro} (apropos "defmacro")))24 (is (some #{'defmacro} (apropos "efmac")))25 (is (= [] (apropos "nothing-has-this-name"))))27 (testing "with a symbol"28 (is (some #{'defmacro} (apropos 'defmacro)))29 (is (some #{'defmacro} (apropos 'efmac)))30 (is (= [] (apropos 'nothing-has-this-name)))))