Permalink
Browse files

Common set functions in midje.clojure.core

  • Loading branch information...
marick committed Jan 26, 2013
1 parent 1f1ee15 commit 6b1cff3e743c8a2f76f8792523e4cda1369fc59f
@@ -3,7 +3,6 @@
(ns ^{:doc "Checkers for collections and strings."}
midje.checking.checkers.collection
(:use midje.clojure.core
- [clojure.set :only [union]]
[midje.util.backwards-compatible-utils :only [every-pred-m]]
[midje.util.form-utils :only [pred-cond macro-for]]
[midje.checking.checkers collection-util util chatty defining collection-comparison]
@@ -1,6 +1,7 @@
(ns ^{:doc "Functions I wouldn't mind to see in clojure.core"}
midje.clojure.core
(:require clojure.pprint
+ clojure.set
utilize.seq))
;; Note: some of this code is taken from https://github.com/flatland/useful/blob/develop/src/flatland/useful/ns.clj
@@ -128,8 +129,6 @@ metadata (as provided by def) merged into the metadata of the original."
;;; Sequences
-;;; Also pull in set operations
-
(defn rotations
"Returns a lazy seq of all rotations of a seq"
[coll]
@@ -143,6 +142,10 @@ metadata (as provided by def) merged into the metadata of the original."
(immigrate-from 'utilize.seq '[separate find-first only])
+ ;;; Sets
+
+(immigrate-from 'clojure.set '[union difference subset? intersection])
+
;;; Printing
View
@@ -1,8 +1,8 @@
(ns ^{:doc "Customizable configuration"}
midje.config
- (:use [midje.error-handling.exceptions :only [user-error]])
+ (:use midje.clojure.core
+ [midje.error-handling.exceptions :only [user-error]])
(:require [midje.emission.levels :as levels]
- [clojure.set :as set]
[midje.util.ecosystem :as ecosystem]))
;;; I consider whether we're running in the repl part of the config. This matters because
@@ -48,7 +48,7 @@
(defmethod validate-key! :default [_])
(defn validate! [changes]
- (let [extras (set/difference (set (keys changes))
+ (let [extras (difference (set (keys changes))
(set (keys *config*)))]
(when (not (empty? extras))
(throw (user-error (str "These are not configuration keys: " (vec extras))))))
@@ -2,7 +2,6 @@
midje.parsing.util.arrows
(:use midje.clojure.core
midje.parsing.arrow-symbols
- [clojure.set :only [union]]
[midje.util form-utils treelike namespace])
(:require [clojure.zip :as zip]))
View
@@ -3,7 +3,6 @@
midje.repl
(:use midje.clojure.core)
(:require midje.sweet
- [clojure.set :as set]
[midje.doc :as doc]
[midje.config :as config]
[midje.parsing.other.arglists :as parsing]
@@ -181,7 +180,7 @@
;; on test namespaces preceding source namespaces.)
(defn- forget-certain-namespaces! [namespaces]
- (dosync (alter @#'clojure.core/*loaded-libs* set/difference (set namespaces))))
+ (dosync (alter @#'clojure.core/*loaded-libs* difference (set namespaces))))
(defn- unloaded? [ns]
(not (contains? @@#'clojure.core/*loaded-libs* ns)))
@@ -3,7 +3,6 @@
(:use midje.clojure.core
[midje.util.treelike :only [tree-variant]]
[midje.util.backwards-compatible-utils :only [every-pred-m]]
- [clojure.set :only [difference]]
[utilize.seq :only (first-truthy-fn)])
(:require [clojure.zip :as zip]))
@@ -235,7 +235,6 @@
(expect (myfun 1) => :list-called
(fake (list 1) => :list-called))))
-(use 'clojure.set)
(defn set-handler [set1 set2]
(if (empty? (intersection set1 set2))
set1
View
@@ -4,7 +4,6 @@
[midje.checking.extended-equality :only [extended-=]]
[midje.checking.extended-falsehood :only [extended-false?]]
midje.error-handling.exceptions
- [clojure.set :only [subset?]]
[midje.util.form-utils :only [macro-for]])
(:require midje.clojure.core
[midje.config :as config]

0 comments on commit 6b1cff3

Please sign in to comment.