Permalink
Browse files

Migrating away from contrib.

  • Loading branch information...
1 parent 15ae82d commit 128755914d2d1c43c794431fa6c0d59d903c81b1 @marick committed Oct 10, 2011
View
7 TIDY
@@ -1,10 +1,3 @@
-total 64
-drwxr-xr-x 9 marick marick 306 Jul 26 16:03 checkers/
-drwxr-xr-x 4 marick marick 136 Jul 26 16:03 error_handling/
-drwxr-xr-x 9 marick marick 306 Jul 26 17:50 ideas/
-drwxr-xr-x 6 marick marick 204 Jul 26 17:44 internal_ideas/
-drwxr-xr-x 14 marick marick 476 Jul 26 16:03 util/
-
src/midje/checkers:
total 88
-rw-r--r-- 1 marick marick 2523 Jul 26 16:03 chatty.clj
View
@@ -3,6 +3,7 @@
:dependencies [[org.clojure/clojure "[1.2.0,1.2.1]"]
[org.clojure/clojure-contrib "1.2.0"]
[ordered "0.3.0"]
+ [org.clojure/math.combinatorics "0.0.1"]
[org.clojure/algo.monads "0.1.0"]
[unifycle "0.5.0"]]
:dev-dependencies [[swank-clojure "1.2.1"]
@@ -4,14 +4,14 @@
(ns midje.checkers.collection
(:use [clojure.set :only [union]]
- [clojure.contrib.seq :only [rotations]]
- [clojure.contrib.def :only [defmacro- defvar-]]
- [clojure.contrib.pprint :only [cl-format]]
- [clojure.contrib.combinatorics :only [permutations]]
+ [midje.util.old-clojure-contrib.seq :only [rotations]]
+ [midje.util.old-clojure-contrib.def :only [defmacro- defvar-]]
+ [clojure.pprint :only [cl-format]]
+ [clojure.math.combinatorics :only [permutations]]
[midje.util.form-utils :only [regex? tack-on-to record? classic-map?]]
[midje.checkers util extended-equality chatty defining]
[midje.util.exceptions :only [user-error]]
- [clojure.contrib.str-utils :only [str-join]]))
+ [clojure.string :only [join]]))
(def looseness-modifiers #{:in-any-order :gaps-ok})
@@ -104,10 +104,10 @@
(fn [midje-classification elements] midje-classification))
(defmethod collection-string ::map [midje-classification elements]
- (str "{" (str-join ", " (sort elements)) "}"))
+ (str "{" (join ", " (sort elements)) "}"))
(defmethod collection-string ::not-map [midje-classification elements]
- (str "[" (str-join " " elements) "]"))
+ (str "[" (join " " elements) "]"))
;;-
(defmulti #^{:private true} best-actual-match
@@ -119,7 +119,7 @@
(defmethod best-actual-match ::map [midje-classification comparison]
(str "Best match found: {"
- (str-join ", "
+ (join ", "
(sort (map (fn [[k v]] (str (pr-str k) " " (pr-str v)))
(:actual-found comparison))))
"}."))
View
@@ -12,7 +12,7 @@
[midje.util.exceptions :only [user-error]]
[midje.production-mode]
[clojure.pprint]
- [clojure.contrib.def :only [defmacro-]]
+ [midje.util.old-clojure-contrib.def :only [defmacro-]]
[clojure.contrib.ns-utils :only [immigrate]]))
(immigrate 'midje.unprocessed)
(immigrate 'midje.ideas.arrow-symbols)
@@ -0,0 +1,41 @@
+;; Copyright (c) Stephen C. Gilardi. 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.
+;;
+;; File: def.clj
+;;
+;; def.clj provides variants of def that make including doc strings and
+;; making private definitions more succinct.
+;;
+;; scgilardi (gmail)
+;; 17 May 2008
+
+(ns
+ #^{:author "Stephen C. Gilardi",
+ :doc "def.clj provides variants of def that make including doc strings and
+making private definitions more succinct."}
+ midje.util.old-clojure-contrib.def)
+
+(defmacro defvar
+ "Defines a var with an optional intializer and doc string"
+ ([name]
+ (list `def name))
+ ([name init]
+ (list `def name init))
+ ([name init doc]
+ (list `def (with-meta name (assoc (meta name) :doc doc)) init)))
+
+(defmacro defmacro-
+ "Same as defmacro but yields a private definition"
+ [name & decls]
+ (list* `defmacro (with-meta name (assoc (meta name) :private true)) decls))
+
+(defmacro defvar-
+ "Same as defvar but yields a private definition"
+ [name & decls]
+ (list* `defvar (with-meta name (assoc (meta name) :private true)) decls))
+
@@ -0,0 +1,37 @@
+;; -*- indent-tabs-mode: nil -*-
+
+;;; seq_utils.clj -- Sequence utilities for Clojure
+
+;; by Stuart Sierra, http://stuartsierra.com/
+;; last updated March 2, 2009
+
+;; Copyright (c) Stuart Sierra, 2008. 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.
+
+
+;; Change Log
+;;
+;; January 10, 2009 (Stuart Sierra):
+;;
+;; * BREAKING CHANGE: "includes?" now takes collection as first
+;; argument. This is more consistent with Clojure collection
+;; functions; see discussion at http://groups.google.com/group/clojure/browse_thread/thread/8b2c8dc96b39ddd7/a8866d34b601ff43
+
+
+
+(ns midje.util.old-clojure-contrib.seq)
+
+(defn rotations
+ "Returns a lazy seq of all rotations of a seq"
+ [x]
+ (if (seq x)
+ (map
+ (fn [n _]
+ (lazy-cat (drop n x) (take n x)))
+ (iterate inc 0) x)
+ (list nil)))

0 comments on commit 1287559

Please sign in to comment.