Mercurial > lasercutter
comparison 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 |
comparison
equal
deleted
inserted
replaced
9:35cf337adfcf | 10:ef7dbbd6452c |
---|---|
1 (ns clojure.test-clojure.repl | |
2 (:use clojure.test | |
3 clojure.repl | |
4 clojure.test-clojure.repl.example)) | |
5 | |
6 (deftest test-source | |
7 (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)))) | |
10 | |
11 (deftest test-dir | |
12 (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))))) | |
15 | |
16 (deftest test-apropos | |
17 (testing "with a regular expression" | |
18 (is (= '[defmacro] (apropos #"^defmacro$"))) | |
19 (is (some #{'defmacro} (apropos #"def.acr."))) | |
20 (is (= [] (apropos #"nothing-has-this-name")))) | |
21 | |
22 (testing "with a string" | |
23 (is (some #{'defmacro} (apropos "defmacro"))) | |
24 (is (some #{'defmacro} (apropos "efmac"))) | |
25 (is (= [] (apropos "nothing-has-this-name")))) | |
26 | |
27 (testing "with a symbol" | |
28 (is (some #{'defmacro} (apropos 'defmacro))) | |
29 (is (some #{'defmacro} (apropos 'efmac))) | |
30 (is (= [] (apropos 'nothing-has-this-name))))) |