diff src/clojure/test_clojure/compilation.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/test_clojure/compilation.clj	Sat Aug 21 06:25:44 2010 -0400
     1.3 @@ -0,0 +1,52 @@
     1.4 +;   Copyright (c) Rich Hickey. All rights reserved.
     1.5 +;   The use and distribution terms for this software are covered by the
     1.6 +;   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
     1.7 +;   which can be found in the file epl-v10.html at the root of this distribution.
     1.8 +;   By using this software in any fashion, you are agreeing to be bound by
     1.9 +;   the terms of this license.
    1.10 +;   You must not remove this notice, or any other, from this software.
    1.11 +
    1.12 +; Author: Frantisek Sodomka
    1.13 +
    1.14 +
    1.15 +(ns clojure.test-clojure.compilation
    1.16 +  (:use clojure.test))
    1.17 +
    1.18 +; http://clojure.org/compilation
    1.19 +
    1.20 +; compile
    1.21 +; gen-class, gen-interface
    1.22 +
    1.23 +
    1.24 +(deftest test-compiler-metadata
    1.25 +  (let [m (meta #'when)]
    1.26 +    (are [x y]  (= x y)
    1.27 +        (list? (:arglists m)) true
    1.28 +        (> (count (:arglists m)) 0) true
    1.29 +
    1.30 +        (string? (:doc m)) true
    1.31 +        (> (.length (:doc m)) 0) true
    1.32 +        
    1.33 +        (string? (:file m)) true
    1.34 +        (> (.length (:file m)) 0) true
    1.35 +
    1.36 +        (integer? (:line m)) true
    1.37 +        (> (:line m) 0) true
    1.38 +
    1.39 +        (:macro m) true
    1.40 +        (:name m) 'when )))
    1.41 +
    1.42 +(deftest test-embedded-constants
    1.43 +  (testing "Embedded constants"
    1.44 +    (is (eval `(= Boolean/TYPE ~Boolean/TYPE)))
    1.45 +    (is (eval `(= Byte/TYPE ~Byte/TYPE)))
    1.46 +    (is (eval `(= Character/TYPE ~Character/TYPE)))
    1.47 +    (is (eval `(= Double/TYPE ~Double/TYPE)))
    1.48 +    (is (eval `(= Float/TYPE ~Float/TYPE)))
    1.49 +    (is (eval `(= Integer/TYPE ~Integer/TYPE)))
    1.50 +    (is (eval `(= Long/TYPE ~Long/TYPE)))
    1.51 +    (is (eval `(= Short/TYPE ~Short/TYPE)))))
    1.52 + 
    1.53 +(deftest test-compiler-resolution
    1.54 +  (testing "resolve nonexistent class create should return nil (assembla #262)"
    1.55 +    (is (nil? (resolve 'NonExistentClass.)))))