aboutsummaryrefslogtreecommitdiff
path: root/src/clojure/contrib/test_clojure
diff options
context:
space:
mode:
authorFrantisek Sodomka <fsodomka@gmail.com>2009-05-27 11:29:30 +0000
committerFrantisek Sodomka <fsodomka@gmail.com>2009-05-27 11:29:30 +0000
commit391898ad586671a635d17ce5def9f098d250394d (patch)
tree7ab635d28e74d3374b7224e2da660237323bdeb8 /src/clojure/contrib/test_clojure
parent64ab3234411e73defdeda12722c911aa8461d178 (diff)
test-clojure: added compilation.clj, macros.clj, metadata.clj;
compilation: compiler metadata; java-interop: dot, double-dot, doto; vars: regression in binding
Diffstat (limited to 'src/clojure/contrib/test_clojure')
-rw-r--r--src/clojure/contrib/test_clojure/compilation.clj32
-rw-r--r--src/clojure/contrib/test_clojure/java_interop.clj22
-rw-r--r--src/clojure/contrib/test_clojure/macros.clj16
-rw-r--r--src/clojure/contrib/test_clojure/metadata.clj17
-rw-r--r--src/clojure/contrib/test_clojure/special.clj12
-rw-r--r--src/clojure/contrib/test_clojure/vars.clj7
6 files changed, 89 insertions, 17 deletions
diff --git a/src/clojure/contrib/test_clojure/compilation.clj b/src/clojure/contrib/test_clojure/compilation.clj
new file mode 100644
index 00000000..3f47ec3b
--- /dev/null
+++ b/src/clojure/contrib/test_clojure/compilation.clj
@@ -0,0 +1,32 @@
+;; Copyright (c) Frantisek Sodomka. All rights reserved. The use and
+;; distribution terms for this software are covered by the Eclipse Public
+;; License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can
+;; be found in the file epl-v10.html at the root of this distribution. By
+;; using this software in any fashion, you are agreeing to be bound by the
+;; terms of this license. You must not remove this notice, or any other,
+;; from this software.
+
+(ns clojure.contrib.test-clojure.compilation
+ (:use clojure.contrib.test-is))
+
+; http://clojure.org/compilation
+
+; compile
+; gen-class, gen-interface
+
+
+(deftest test-compiler-metadata
+ (let [m ^#'when]
+ (are (= _1 _2)
+ (list? (:arglists m)) true
+
+ (string? (:doc m)) true
+ (string? (:file m)) true
+
+ (integer? (:line m)) true
+ (> (:line m) 0) true
+
+ (:macro m) true
+ (:name m) 'when )))
+
+
diff --git a/src/clojure/contrib/test_clojure/java_interop.clj b/src/clojure/contrib/test_clojure/java_interop.clj
index 5384dcc8..346a6e7f 100644
--- a/src/clojure/contrib/test_clojure/java_interop.clj
+++ b/src/clojure/contrib/test_clojure/java_interop.clj
@@ -16,6 +16,23 @@
; . ..
; doto
+(deftest test-dot
+ (are (= _1 _2)
+ (. Integer MAX_VALUE) Integer/MAX_VALUE
+ (. Integer MAX_VALUE) java.lang.Integer/MAX_VALUE ))
+
+(deftest test-double-dot
+ (is (= (.. System (getProperties) (get "os.name"))
+ (. (. System (getProperties)) (get "os.name")))))
+
+(deftest test-doto
+ (let [doto-map (doto (new java.util.HashMap)
+ (.put "a" 1)
+ (.put "b" 2))]
+ (is (= (class doto-map) java.util.HashMap))
+ (is (= doto-map {"a" 1 "b" 2}))))
+
+
; new
; instance?
@@ -26,8 +43,6 @@
; bean
; proxy, proxy-super
-; gen-class, gen-interface
-; compile
; bases, supers
@@ -41,6 +56,3 @@
; Coercions: int, long, float, double, char, boolean, short, byte
; num
; ints/longs/floats/doubles
-
-; Simple XML Support: xml/parse
-
diff --git a/src/clojure/contrib/test_clojure/macros.clj b/src/clojure/contrib/test_clojure/macros.clj
new file mode 100644
index 00000000..40fd99ba
--- /dev/null
+++ b/src/clojure/contrib/test_clojure/macros.clj
@@ -0,0 +1,16 @@
+;; Copyright (c) Frantisek Sodomka. All rights reserved. The use and
+;; distribution terms for this software are covered by the Eclipse Public
+;; License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can
+;; be found in the file epl-v10.html at the root of this distribution. By
+;; using this software in any fashion, you are agreeing to be bound by the
+;; terms of this license. You must not remove this notice, or any other,
+;; from this software.
+
+(ns clojure.contrib.test-clojure.macros
+ (:use clojure.contrib.test-is))
+
+; http://clojure.org/macros
+
+; ->
+; defmacro definline macroexpand-1 macroexpand
+
diff --git a/src/clojure/contrib/test_clojure/metadata.clj b/src/clojure/contrib/test_clojure/metadata.clj
new file mode 100644
index 00000000..ea0cdbe1
--- /dev/null
+++ b/src/clojure/contrib/test_clojure/metadata.clj
@@ -0,0 +1,17 @@
+;; Copyright (c) Frantisek Sodomka. All rights reserved. The use and
+;; distribution terms for this software are covered by the Eclipse Public
+;; License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can
+;; be found in the file epl-v10.html at the root of this distribution. By
+;; using this software in any fashion, you are agreeing to be bound by the
+;; terms of this license. You must not remove this notice, or any other,
+;; from this software.
+
+(ns clojure.contrib.test-clojure.metadata
+ (:use clojure.contrib.test-is))
+
+
+; http://clojure.org/metadata
+
+; meta
+; with-meta
+
diff --git a/src/clojure/contrib/test_clojure/special.clj b/src/clojure/contrib/test_clojure/special.clj
index dcb6a561..298ef534 100644
--- a/src/clojure/contrib/test_clojure/special.clj
+++ b/src/clojure/contrib/test_clojure/special.clj
@@ -19,15 +19,3 @@
; var
; fn
-
-; http://clojure.org/macros
-
-; ->
-; defmacro definline macroexpand-1 macroexpand
-
-
-; http://clojure.org/metadata
-
-; meta
-; with-meta
-
diff --git a/src/clojure/contrib/test_clojure/vars.clj b/src/clojure/contrib/test_clojure/vars.clj
index 5b76cc43..f3b2e8ff 100644
--- a/src/clojure/contrib/test_clojure/vars.clj
+++ b/src/clojure/contrib/test_clojure/vars.clj
@@ -16,6 +16,13 @@
; declare intern binding find-var var
+(def a)
+(deftest test-binding
+ (are (= _1 _2)
+ (eval `(binding [a 4] a)) 4 ; regression in Clojure SVN r1370
+ ))
+
+
; with-local-vars var-get var-set alter-var-root [var? (predicates.clj)]
; with-in-str with-out-str
; with-open