aboutsummaryrefslogtreecommitdiff
path: root/src/clojure/contrib/test_clojure/printer.clj
diff options
context:
space:
mode:
authorscgilardi <scgilardi@gmail.com>2008-10-30 04:29:38 +0000
committerscgilardi <scgilardi@gmail.com>2008-10-30 04:29:38 +0000
commit17bac249a1b72613e720541c9ec263f83348f8f0 (patch)
tree83c9b796f32e841077a1c3890ded85aa0440849d /src/clojure/contrib/test_clojure/printer.clj
parentfa24c1428e12b51fa6b4b78e6179ef7b71bbff78 (diff)
new tests dir, test-clojure will load any .clj files in it and then run all defined tests
Diffstat (limited to 'src/clojure/contrib/test_clojure/printer.clj')
-rw-r--r--src/clojure/contrib/test_clojure/printer.clj76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/clojure/contrib/test_clojure/printer.clj b/src/clojure/contrib/test_clojure/printer.clj
deleted file mode 100644
index d5779ec1..00000000
--- a/src/clojure/contrib/test_clojure/printer.clj
+++ /dev/null
@@ -1,76 +0,0 @@
-;; Copyright (c) Stephen C. Gilardi. All rights reserved. The use and
-;; distribution terms for this software are covered by the Common Public
-;; License 1.0 (http://opensource.org/licenses/cpl.php) which can be found
-;; in the file CPL.TXT 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.
-;;
-;; scgilardi (gmail)
-;; Created 29 October 2008
-
-(deftest t-print-length-empty-seq
- (let [coll () val "()"]
- (is (= val (binding [*print-length* 0] (print-str coll))))
- (is (= val (binding [*print-length* 1] (print-str coll))))))
-
-(deftest t-print-length-seq
- (let [coll (range 5)
- length-val '((0 "(...)")
- (1 "(0 ...)")
- (2 "(0 1 ...)")
- (3 "(0 1 2 ...)")
- (4 "(0 1 2 3 ...)")
- (5 "(0 1 2 3 4)"))]
- (doseq [length val] length-val
- (binding [*print-length* length]
- (is (= val (print-str coll)))))))
-
-(deftest t-print-length-empty-vec
- (let [coll [] val "[]"]
- (is (= val (binding [*print-length* 0] (print-str coll))))
- (is (= val (binding [*print-length* 1] (print-str coll))))))
-
-(deftest t-print-length-vec
- (let [coll [0 1 2 3 4]
- length-val '((0 "[...]")
- (1 "[0 ...]")
- (2 "[0 1 ...]")
- (3 "[0 1 2 ...]")
- (4 "[0 1 2 3 ...]")
- (5 "[0 1 2 3 4]"))]
- (doseq [length val] length-val
- (binding [*print-length* length]
- (is (= val (print-str coll)))))))
-
-(deftest t-print-level-seq
- (let [coll '(0 (1 (2 (3 (4)))))
- level-val '((0 "#")
- (1 "(0 #)")
- (2 "(0 (1 #))")
- (3 "(0 (1 (2 #)))")
- (4 "(0 (1 (2 (3 #))))")
- (5 "(0 (1 (2 (3 (4)))))"))]
- (doseq [level val] level-val
- (binding [*print-level* level]
- (is (= val (print-str coll)))))))
-
-(deftest t-print-level-length-coll
- (let [coll '(if (member x y) (+ (first x) 3) (foo (a b c d "Baz")))
- level-length-val
- '((0 1 "#")
- (1 1 "(if ...)")
- (1 2 "(if # ...)")
- (1 3 "(if # # ...)")
- (1 4 "(if # # #)")
- (2 1 "(if ...)")
- (2 2 "(if (member x ...) ...)")
- (2 3 "(if (member x y) (+ # 3) ...)")
- (3 2 "(if (member x ...) ...)")
- (3 3 "(if (member x y) (+ (first x) 3) ...)")
- (3 4 "(if (member x y) (+ (first x) 3) (foo (a b c d ...)))")
- (3 5 "(if (member x y) (+ (first x) 3) (foo (a b c d Baz)))"))]
- (doseq [level length val] level-length-val
- (binding [*print-level* level
- *print-length* length]
- (is (= val (print-str coll)))))))