view 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
line wrap: on
line source
1 ;; Tests for def.clj
3 ;; by Stuart Halloway
5 ;; Copyright (c) Stuart Halloway, 2009. All rights reserved. The use
6 ;; and distribution terms for this software are covered by the Eclipse
7 ;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
8 ;; which can be found in the file epl-v10.html at the root of this
9 ;; distribution. By using this software in any fashion, you are
10 ;; agreeing to be bound by the terms of this license. You must not
11 ;; remove this notice, or any other, from this software.
13 (ns clojure.contrib.test-def
14 (:use clojure.test)
15 (:require [clojure.contrib.def :as d]))
17 (defn sample-fn "sample-fn docstring" [])
18 (d/defalias aliased-fn sample-fn)
19 (defmacro sample-macro "sample-macro-docstring" [])
20 (d/defalias aliased-macro sample-macro)
22 (deftest defalias-preserves-metadata
23 (let [preserved-meta #(-> % (meta) (select-keys [:doc :arglists :ns :file :macro]))]
24 (are [x y] (= (preserved-meta (var x)) (preserved-meta (var y)))
25 aliased-fn sample-fn
26 aliased-macro sample-macro)))