diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/clojure/contrib/test_contrib/test_def.clj	Sat Aug 21 06:25:44 2010 -0400
     1.3 @@ -0,0 +1,27 @@
     1.4 +;; Tests for def.clj
     1.5 +
     1.6 +;; by Stuart Halloway
     1.7 +
     1.8 +;; Copyright (c) Stuart Halloway, 2009. All rights reserved.  The use
     1.9 +;; and distribution terms for this software are covered by the Eclipse
    1.10 +;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
    1.11 +;; which can be found in the file epl-v10.html at the root of this
    1.12 +;; distribution.  By using this software in any fashion, you are
    1.13 +;; agreeing to be bound by the terms of this license.  You must not
    1.14 +;; remove this notice, or any other, from this software.
    1.15 +
    1.16 +(ns clojure.contrib.test-def
    1.17 +  (:use clojure.test)
    1.18 +  (:require [clojure.contrib.def :as d]))
    1.19 +
    1.20 +(defn sample-fn "sample-fn docstring" [])
    1.21 +(d/defalias aliased-fn sample-fn)
    1.22 +(defmacro sample-macro "sample-macro-docstring" [])
    1.23 +(d/defalias aliased-macro sample-macro)
    1.24 +
    1.25 +(deftest defalias-preserves-metadata
    1.26 +  (let [preserved-meta #(-> % (meta) (select-keys [:doc :arglists :ns :file :macro]))]
    1.27 +    (are [x y] (= (preserved-meta (var x)) (preserved-meta (var y)))
    1.28 +         aliased-fn sample-fn
    1.29 +         aliased-macro sample-macro)))
    1.30 +