Mercurial > lasercutter
annotate src/clojure/contrib/test_contrib/test_def.clj @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
rev | line source |
---|---|
rlm@10 | 1 ;; Tests for def.clj |
rlm@10 | 2 |
rlm@10 | 3 ;; by Stuart Halloway |
rlm@10 | 4 |
rlm@10 | 5 ;; Copyright (c) Stuart Halloway, 2009. All rights reserved. The use |
rlm@10 | 6 ;; and distribution terms for this software are covered by the Eclipse |
rlm@10 | 7 ;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) |
rlm@10 | 8 ;; which can be found in the file epl-v10.html at the root of this |
rlm@10 | 9 ;; distribution. By using this software in any fashion, you are |
rlm@10 | 10 ;; agreeing to be bound by the terms of this license. You must not |
rlm@10 | 11 ;; remove this notice, or any other, from this software. |
rlm@10 | 12 |
rlm@10 | 13 (ns clojure.contrib.test-def |
rlm@10 | 14 (:use clojure.test) |
rlm@10 | 15 (:require [clojure.contrib.def :as d])) |
rlm@10 | 16 |
rlm@10 | 17 (defn sample-fn "sample-fn docstring" []) |
rlm@10 | 18 (d/defalias aliased-fn sample-fn) |
rlm@10 | 19 (defmacro sample-macro "sample-macro-docstring" []) |
rlm@10 | 20 (d/defalias aliased-macro sample-macro) |
rlm@10 | 21 |
rlm@10 | 22 (deftest defalias-preserves-metadata |
rlm@10 | 23 (let [preserved-meta #(-> % (meta) (select-keys [:doc :arglists :ns :file :macro]))] |
rlm@10 | 24 (are [x y] (= (preserved-meta (var x)) (preserved-meta (var y))) |
rlm@10 | 25 aliased-fn sample-fn |
rlm@10 | 26 aliased-macro sample-macro))) |
rlm@10 | 27 |