Skip to content
This repository
Browse code

Renamed form-utils into pile (as in "pile o' stuff that doesn't have …

…a better place now).
  • Loading branch information...
commit 1c1ee9af36ad31243795cda85c0355de8e5ff84f 1 parent a90c5ab
Brian Marick authored

Showing 26 changed files with 74 additions and 93 deletions. Show diff stats Hide diff stats

  1. +0 1  src/midje/checking/checkers/chatty.clj
  2. +4 4 src/midje/checking/checkers/collection.clj
  3. +9 9 src/midje/checking/checkers/collection_comparison.clj
  4. +3 3 src/midje/checking/checkers/defining.clj
  5. +0 1  src/midje/checking/checkers/simple.clj
  6. +0 1  src/midje/checking/examples.clj
  7. +0 1  src/midje/data/prerequisite_state.clj
  8. +3 3 src/midje/error_handling/background_validations.clj
  9. +5 5 src/midje/parsing/0_to_fact_form/formulas.clj
  10. +3 3 src/midje/parsing/1_to_explicit_form/facts.clj
  11. +3 3 src/midje/parsing/1_to_explicit_form/future_facts.clj
  12. +3 4 src/midje/parsing/2_to_lexical_maps/examples.clj
  13. +0 1  src/midje/parsing/2_to_lexical_maps/fakes.clj
  14. +2 2 src/midje/parsing/2_to_lexical_maps/folded_fakes.clj
  15. +1 1  src/midje/parsing/lexical_maps.clj
  16. +3 3 src/midje/parsing/other/arglists.clj
  17. +1 2  src/midje/parsing/util/arrows.clj
  18. +1 2  src/midje/parsing/util/fnref.clj
  19. +0 1  src/midje/repl.clj
  20. +4 3 src/midje/semi_sweet.clj
  21. +0 1  src/midje/sweet.clj
  22. +10 10 src/midje/util.clj
  23. +7 15 src/midje/util/{form_utils.clj → pile.clj}
  24. +9 10 test/midje/parsing/2_to_lexical_maps/t_examples.clj
  25. +1 2  test/midje/test_util.clj
  26. +2 2 test/midje/util/{t_form_utils.clj → t_pile.clj}
1  src/midje/checking/checkers/chatty.clj
... ... @@ -1,7 +1,6 @@
1 1 (ns ^{:doc "Checkers that explain more about a failure."}
2 2 midje.checking.checkers.chatty
3 3 (:use midje.clojure.core
4   - midje.util.form-utils
5 4 [midje.checking.checkers.util :only [named-as-call]]
6 5 [midje.checking.extended-falsehood :only [data-laden-falsehood?
7 6 as-data-laden-falsehood
8 src/midje/checking/checkers/collection.clj
@@ -3,11 +3,11 @@
3 3 (ns ^{:doc "Checkers for collections and strings."}
4 4 midje.checking.checkers.collection
5 5 (:use midje.clojure.core
6   - [midje.util.form-utils :only [macro-for]]
7 6 [midje.checking.checkers collection-util util chatty defining collection-comparison]
8 7 midje.checking.extended-equality
9 8 [midje.checking.extended-falsehood :only [extended-true?]]
10   - [midje.error-handling.exceptions :only [user-error]]))
  9 + [midje.error-handling.exceptions :only [user-error]])
  10 + (:require [midje.util.pile :as pile]))
11 11
12 12
13 13 (def #^:private looseness-modifiers #{:in-any-order :gaps-ok})
@@ -241,8 +241,8 @@ just is also useful if you don't care about order:
241 241 (every? #(extended-= % expected) actual))))
242 242
243 243 (defmacro #^:private generate-n-of-checkers []
244   - (macro-for [[num num-word] [[1 "one"] [2 "two"] [3 "three"] [4 "four"] [5 "five"]
245   - [6 "six"] [7 "seven"] [8 "eight"] [9 "nine"] [10 "ten"]]]
  244 + (pile/macro-for [[num num-word] [[1 "one"] [2 "two"] [3 "three"] [4 "four"] [5 "five"]
  245 + [6 "six"] [7 "seven"] [8 "eight"] [9 "nine"] [10 "ten"]]]
246 246 (let [name (symbol (str num-word "-of"))
247 247 docstring (cl-format nil "Checks whether a sequence contains precisely ~R result~:[s, and \n that they each match~;, and \n that it matches~] the checker.
248 248
18 src/midje/checking/checkers/collection_comparison.clj
@@ -4,11 +4,11 @@
4 4 midje.checking.checkers.collection-comparison
5 5 (:use midje.clojure.core
6 6 [clojure.math.combinatorics :only [permutations]]
7   - [midje.util.form-utils :only [tack-on-to sort-map]]
8 7 [midje.util.object-utils :only [function-name named-function?]]
9 8 [midje.checking.checkers collection-util util chatty defining]
10   - midje.checking.extended-equality
11   - [clojure.string :only [join]]))
  9 + midje.checking.extended-equality)
  10 + (:require [clojure.string :as str]
  11 + [midje.util.pile :as pile]))
12 12
13 13 ;; There is an annoying only-semi-similarity between maps and sequences.
14 14 ;; These are the generic functions.
@@ -21,10 +21,10 @@
21 21 (fn [midje-classification _elements_] midje-classification))
22 22
23 23 (defmethod collection-string ::map [_midje-classification_ elements]
24   - (str "{" (join ", " (sort elements)) "}"))
  24 + (str "{" (str/join ", " (sort elements)) "}"))
25 25
26 26 (defmethod collection-string ::not-map [_midje-classification_ elements]
27   - (str "[" (join " " elements) "]"))
  27 + (str "[" (str/join " " elements) "]"))
28 28 ;;-
29 29
30 30 (defmulti best-actual-match
@@ -35,7 +35,7 @@
35 35 (str "Best match found: " (pr-str (:actual-found comparison))))
36 36
37 37 (defmethod best-actual-match ::map [_midje-classification_ comparison]
38   - (str "Best match found: " (pr-str (sort-map (:actual-found comparison)))))
  38 + (str "Best match found: " (pr-str (pile/sort-map (:actual-found comparison)))))
39 39
40 40 (defmulti best-expected-match
41 41 "Describe the best list of expected values found in the comparison."
@@ -109,7 +109,7 @@
109 109 (concat (:expected-skipped-over candidate) (rest walking-expected))
110 110 best-so-far
111 111 (merge
112   - (tack-on-to candidate
  112 + (pile/tack-on-to candidate
113 113 :actual-found (first walking-actual)
114 114 :expected-found (first walking-expected))
115 115 {:expected-skipped-over []}))
@@ -119,7 +119,7 @@
119 119 (recur walking-actual
120 120 (rest walking-expected)
121 121 best-so-far
122   - (tack-on-to candidate
  122 + (pile/tack-on-to candidate
123 123 :expected-skipped-over (first walking-expected)))
124 124
125 125 (not (empty? (rest walking-actual)))
@@ -210,7 +210,7 @@
210 210 (rest walking-actual)
211 211 (rest walking-expected)
212 212 best-so-far
213   - (tack-on-to candidate
  213 + (pile/tack-on-to candidate
214 214 :actual-found (first walking-actual)
215 215 :expected-found (first walking-expected)))
216 216
6 src/midje/checking/checkers/defining.clj
... ... @@ -1,6 +1,6 @@
1 1 (ns ^{:doc "Various ways to define checkers."}
2 2 midje.checking.checkers.defining
3   - (:use [midje.util.form-utils :only [pop-docstring pop-opts-map]]))
  3 + (:require [midje.util.pile :as pile]))
4 4
5 5 (defn as-checker
6 6 "Label a function as a checker. This is only required if
@@ -59,8 +59,8 @@
59 59 "
60 60 {:arglists '([name docstring? attr-map? bindings+bodies])}
61 61 [name & args]
62   - (let [[docstring more-args] (pop-docstring args)
63   - [attr-map bindings+bodies] (pop-opts-map more-args)]
  62 + (let [[docstring more-args] (pile/pop-docstring args)
  63 + [attr-map bindings+bodies] (pile/pop-opts-map more-args)]
64 64 (working-with-arglists+bodies name docstring attr-map bindings+bodies))))
65 65
66 66 (defmacro checker
1  src/midje/checking/checkers/simple.clj
@@ -9,7 +9,6 @@
9 9 [midje.checking.checkers.util :only [named-as-call]]
10 10 [midje.error-handling.exceptions :only [captured-throwable?]]
11 11 [midje.util.ecosystem :only [clojure-1-3? +M -M *M]]
12   - [midje.util.form-utils :only [def-many-methods]]
13 12 [clojure.algo.monads :only [domonad set-m]])
14 13 (:import [midje.error_handling.exceptions ICapturedThrowable]))
15 14
1  src/midje/checking/examples.clj
@@ -4,7 +4,6 @@
4 4 [midje.checking.extended-equality :only [extended-= evaluate-checking-function]]
5 5 [midje.error-handling.exceptions :only [captured-throwable]]
6 6 midje.data.prerequisite-state
7   - midje.util.form-utils
8 7 midje.util.laziness)
9 8 (:require [midje.config :as config]
10 9 [midje.emission.boundaries :as emission-boundary]
1  src/midje/data/prerequisite_state.clj
@@ -2,7 +2,6 @@
2 2 midje.data.prerequisite-state
3 3 (:use midje.clojure.core
4 4 [midje.util.object-utils :only [object-name]]
5   - midje.util.form-utils
6 5 [midje.checking.extended-equality :only [extended-= extended-list-=]]
7 6 [midje.util.thread-safe-var-nesting :only [namespace-values-inside-out
8 7 with-altered-roots]]
6 src/midje/error_handling/background_validations.clj
@@ -5,13 +5,13 @@
5 5 validation-error-report-form validate when-valid]]
6 6 [midje.parsing.util.arrows :only [start-of-checking-arrow-sequence? take-arrow-sequence]]
7 7 [midje.parsing.1-to-explicit-form.background :only [seq-headed-by-setup-teardown-form?]]
8   - [midje.parsing.1-to-explicit-form.prerequisites :only [metaconstant-prerequisite?]]
9   - [midje.util.form-utils :only [def-many-methods]]))
  8 + [midje.parsing.1-to-explicit-form.prerequisites :only [metaconstant-prerequisite?]])
  9 + (:require [midje.util.pile :as pile]))
10 10
11 11 (def #^:private possible-wrapping-targets #{:facts, :contents, :checks })
12 12 (def #^:private possible-state-descriptions #{"before" "after" "around"})
13 13
14   -(def-many-methods validate ["before" "after" "around"] [[state-description wrapping-target expression :as form]]
  14 +(pile/def-many-methods validate ["before" "after" "around"] [[state-description wrapping-target expression :as form]]
15 15 (cond
16 16 (and (#{"after" "around"} (name state-description)) (not= 3 (count form)))
17 17 (validation-error-report-form form
10 src/midje/parsing/0_to_fact_form/formulas.clj
@@ -7,9 +7,9 @@
7 7 [midje.parsing.1-to-explicit-form.future-facts :only [future-prefixes]]
8 8 [clojure.algo.monads :only [domonad]]
9 9 [clojure.string :only [join]]
10   - [midje.util.form-utils]
11 10 [clojure.walk :only [prewalk]])
12   - (:require [midje.emission.boundaries :as emission-boundary]
  11 + (:require [midje.util.pile :as pile]
  12 + [midje.emission.boundaries :as emission-boundary]
13 13 [midje.emission.api :as emit]
14 14 [midje.emission.state :as state]
15 15 [midje.emission.plugins.silence :as emission-silence]))
@@ -34,8 +34,8 @@
34 34 `(midje.sweet/fact ~docstring ~@body))
35 35
36 36 (defn- deconstruct-formula-args [args]
37   - (let [[docstring? more-args] (pop-docstring args)
38   - [opts-map [bindings & body]] (pop-opts-map more-args)]
  37 + (let [[docstring? more-args] (pile/pop-docstring args)
  38 + [opts-map [bindings & body]] (pile/pop-opts-map more-args)]
39 39 [docstring? opts-map bindings body]))
40 40
41 41
@@ -88,7 +88,7 @@
88 88
89 89
90 90 (defmacro generate-future-formula-variants []
91   - (macro-for [name future-formula-variant-names]
  91 + (pile/macro-for [name future-formula-variant-names]
92 92 `(defmacro ~(symbol name)
93 93 "ALPHA/EXPERIMENTAL (subject to change)
94 94 Formula that will not be run. Generates 'WORK TO DO' report output as a reminder."
6 src/midje/parsing/1_to_explicit_form/facts.clj
@@ -22,12 +22,12 @@
22 22 against-background-facts-and-checks-wrappers
23 23 against-background?]]
24 24 [midje.parsing.1-to-explicit-form.metaconstants :only [predefine-metaconstants-from-form]]
25   - [midje.util.form-utils :only [def-many-methods]]
26 25 [midje.util.laziness :only [eagerly]]
27 26 [midje.parsing.util.zip :only [skip-to-rightmost-leaf]]
28 27 [swiss-arrows.core :only [-<>]])
29 28 (:require [clojure.zip :as zip])
30   - (:require [midje.checking.facts :as fact-checking]
  29 + (:require [midje.util.pile :as pile]
  30 + [midje.checking.facts :as fact-checking]
31 31 [midje.data.compendium :as compendium]
32 32 [midje.parsing.1-to-explicit-form.future-facts :as parse-future-facts]
33 33 [midje.parsing.2-to-lexical-maps.folded-fakes :as parse-folded-fakes]
@@ -155,7 +155,7 @@
155 155
156 156 ;;; There could be validation here, but none has proven useful.
157 157
158   -(def-many-methods validate ["fact" "facts"] [[fact-or-facts & args :as form]]
  158 +(pile/def-many-methods validate ["fact" "facts"] [[fact-or-facts & args :as form]]
159 159 ;; Removed the check for no arrow because (1) it gives me too many false
160 160 ;; positives and (2) doesn't fit with new handling of tabulate. Replace
161 161 ;; someday with a version that correctly detects forms like this:
6 src/midje/parsing/1_to_explicit_form/future_facts.clj
... ... @@ -1,8 +1,8 @@
1 1 (ns ^{:doc "Parsing future-facts."}
2 2 midje.parsing.1-to-explicit-form.future-facts
3 3 (:use midje.parsing.util.core)
4   - (:use [midje.util.form-utils :only [macro-for]])
5   - (:require [midje.parsing.util.file-position :as position]
  4 + (:require [midje.util.pile :as pile]
  5 + [midje.parsing.util.file-position :as position]
6 6 [midje.data.nested-facts :as nested-facts]
7 7 [midje.parsing.1-to-explicit-form.metadata :as parse-metadata]
8 8 [midje.emission.api :as emit]))
@@ -17,7 +17,7 @@
17 17 (str prefix fact-or-facts)))
18 18
19 19 (defmacro generate-variants []
20   - (macro-for [name future-fact-variant-names]
  20 + (pile/macro-for [name future-fact-variant-names]
21 21 `(defmacro ~(symbol name)
22 22 "Fact that will not be run. Generates 'WORK TO DO' report output as a reminder."
23 23 {:arglists '([& forms])}
7 src/midje/parsing/2_to_lexical_maps/examples.clj
@@ -7,8 +7,6 @@
7 7 [midje.checkers :only [exactly]]
8 8 [midje.checking.checkers.defining :only [checker? checker-makers]]
9 9 [midje.parsing.1-to-explicit-form.expects :only [expect? up-to-full-expect-form]]
10   - [midje.util.form-utils :only [map-difference
11   - def-many-methods ]]
12 10 [midje.checking.extended-equality :only [extended-= extended-list-=]]
13 11 [midje.parsing.util.file-position :only [user-file-position]]
14 12 [midje.util.thread-safe-var-nesting :only [namespace-values-inside-out
@@ -19,7 +17,8 @@
19 17 midje.error-handling.validation-errors
20 18 midje.error-handling.semi-sweet-validations
21 19 [clojure.tools.macro :only [macrolet]])
22   - (:require [midje.data.metaconstant :as metaconstant]
  20 + (:require [midje.util.pile :as pile]
  21 + [midje.data.metaconstant :as metaconstant]
23 22 [midje.data.nested-facts :as nested-facts]
24 23 [clojure.zip :as zip]
25 24 [midje.config :as config]
@@ -32,7 +31,7 @@
32 31 (defmulti expect-expansion (fn [_call-form_ arrow & _rhs_]
33 32 (name arrow)))
34 33
35   -(def-many-methods expect-expansion [=> =not=> =deny=>]
  34 +(pile/def-many-methods expect-expansion [=> =not=> =deny=>]
36 35 [call-form arrow expected-result fakes overrides]
37 36 `(let [check# (lexical-maps/example ~call-form ~arrow ~expected-result ~overrides)]
38 37 (midje.checking.examples/check-one check# ~fakes)))
1  src/midje/parsing/2_to_lexical_maps/fakes.clj
@@ -7,7 +7,6 @@
7 7 [midje.checkers :only [exactly]]
8 8 [midje.checking.checkers.defining :only [checker? checker-makers]]
9 9 [midje.parsing.1-to-explicit-form.expects :only [expect? up-to-full-expect-form]]
10   - [midje.util.form-utils :only [map-difference]]
11 10 [midje.checking.extended-equality :only [extended-= extended-list-=]]
12 11 [midje.parsing.util.file-position :only [user-file-position]]
13 12 [midje.util.thread-safe-var-nesting :only [namespace-values-inside-out
4 src/midje/parsing/2_to_lexical_maps/folded_fakes.clj
... ... @@ -1,9 +1,9 @@
1 1 (ns ^{:doc "Unfolding prerequisites like `(f (g 1)) => 3`"}
2 2 midje.parsing.2-to-lexical-maps.folded-fakes
3 3 (:use midje.parsing.util.zip
4   - [midje.util.form-utils :only [map-difference]]
5 4 [midje.checking.checkers.defining :only [checker? checker-makers]])
6 5 (:require [clojure.zip :as zip]
  6 + [midje.util.pile :as pile]
7 7 [midje.parsing.1-to-explicit-form.expects :as expects]
8 8 [midje.parsing.util.fnref :as fnref]))
9 9
@@ -79,7 +79,7 @@
79 79 (let [overrides (drop 4 target)
80 80 augmented-substitutions (augment-substitutions substitutions target)
81 81 flattened-target (flatten-fake target augmented-substitutions)
82   - generated-fakes (generate-fakes (map-difference augmented-substitutions substitutions) overrides)]
  82 + generated-fakes (generate-fakes (pile/map-difference augmented-substitutions substitutions) overrides)]
83 83 [(conj finished flattened-target),
84 84 (concat generated-fakes (rest pending)),
85 85 augmented-substitutions]))))
2  src/midje/parsing/lexical_maps.clj
@@ -29,7 +29,7 @@
29 29 :function-under-test (clojure.core/fn [] (cons a [2])),
30 30 :description (midje.data.nested-facts/descriptions)}
31 31 {:arrow '=>, :call-form '(cons a [2])}
32   - (midje.util.form-utils/hash-map-duplicates-ok
  32 + (midje.clojure.core/hash-map-duplicates-ok
33 33 :position
34 34 (midje.parsing.util.file-position/line-number-known 2)))
35 35 ) ; ---------------------------------------------------------------
6 src/midje/parsing/other/arglists.clj
@@ -5,7 +5,7 @@
5 5 [midje.error-handling.exceptions :only [user-error]])
6 6 (:require [midje.emission.levels :as levels]
7 7 [midje.config :as config]
8   - [midje.util.form-utils :as form]
  8 + [midje.util.pile :as pile]
9 9 [midje.data.fact :as fact]))
10 10
11 11
@@ -40,7 +40,7 @@
40 40
41 41 (defn desired-fact-predicate-from [desireds]
42 42 (vary-meta
43   - (form/any-pred-from (map appropriate-matcher-for desireds))
  43 + (pile/any-pred-from (map appropriate-matcher-for desireds))
44 44 assoc :created-from desireds))
45 45
46 46
@@ -48,7 +48,7 @@
48 48 ([args plain-argument?]
49 49 (let [[filters remainder]
50 50 (separate #(and (not (plain-argument? %))
51   - ((form/any-pred-from [string? regex? fn? keyword?]) %))
  51 + ((pile/any-pred-from [string? regex? fn? keyword?]) %))
52 52 args)]
53 53 [filters
54 54 (desired-fact-predicate-from filters)
3  src/midje/parsing/util/arrows.clj
@@ -2,8 +2,7 @@
2 2 midje.parsing.util.arrows
3 3 (:use midje.clojure.core
4 4 midje.parsing.util.core
5   - midje.parsing.arrow-symbols
6   - [midje.util form-utils])
  5 + midje.parsing.arrow-symbols)
7 6 (:require [clojure.zip :as zip]))
8 7
9 8 ;; Arrow groupings
3  src/midje/parsing/util/fnref.clj
... ... @@ -1,8 +1,7 @@
1 1 (ns ^{:doc "A fnref is the first symbol-or-var in a list. These utilities
2 2 allow you to interpret it in multiple ways."}
3 3 midje.parsing.util.fnref
4   - (:use midje.clojure.core
5   - [midje.util.form-utils]))
  4 + (:use midje.clojure.core))
6 5
7 6
8 7 (defn classify-function-reference [reference]
1  src/midje/repl.clj
@@ -13,7 +13,6 @@
13 13 [midje.emission.boundaries :as emission-boundary]
14 14 [midje.emission.colorize :as color]
15 15 [midje.emission.api :as emit]
16   - [midje.util.form-utils :as form]
17 16 [midje.util.ecosystem :as ecosystem]
18 17 [midje.util.scheduling :as scheduling]))
19 18
7 src/midje/semi_sweet.clj
@@ -3,7 +3,7 @@
3 3 midje.semi-sweet
4 4 (:use midje.clojure.core
5 5 midje.data.prerequisite-state
6   - [midje.util debugging form-utils]
  6 + [midje.util debugging]
7 7 [midje.emission.deprecation :only [deprecate]]
8 8 midje.error-handling.validation-errors
9 9 midje.error-handling.semi-sweet-validations
@@ -13,7 +13,8 @@
13 13 midje.production-mode
14 14 [clojure.algo.monads :only [domonad]]
15 15 [clojure.string :only [join]])
16   - (:require [midje.data.nested-facts :as nested-facts]
  16 + (:require [midje.util.pile :as pile]
  17 + [midje.data.nested-facts :as nested-facts]
17 18 [midje.parsing.lexical-maps :as lexical-maps]
18 19 [midje.emission.api :as emit]
19 20 midje.checking.examples
@@ -29,7 +30,7 @@
29 30 ;;; Interface: unfinished
30 31
31 32 (letfn [(unfinished* [names]
32   - (macro-for [name names]
  33 + (pile/macro-for [name names]
33 34 `(do
34 35 (defn ~name [& args#]
35 36 (let [pprint# (partial cl-format nil "~S")]
1  src/midje/sweet.clj
@@ -12,7 +12,6 @@
12 12 midje.error-handling.exceptions
13 13 midje.error-handling.validation-errors
14 14 midje.util.debugging
15   - [midje.util.form-utils :only [macro-for]]
16 15 [midje.parsing.util.wrapping :only [put-wrappers-into-effect]]
17 16 [midje.parsing.util.file-position :only [set-fallback-line-number-from]]
18 17 [midje.parsing.1-to-explicit-form.facts :only [complete-fact-transformation
20 src/midje/util.clj
... ... @@ -1,21 +1,21 @@
1 1 (ns ^{:doc "Utility code for testing private vars."}
2 2 midje.util
3   - (:use [midje.util.form-utils :only [macro-for]]))
  3 + (:require [midje.util.pile :as pile]))
4 4
5 5 (defmacro expose-testables
6 6 "Enables testing of vars in the target ns which have ^:testable metadata.
7 7 Note that the namespace names should not be quoted."
8 8 [target-ns]
9   - (macro-for [[sym var] (ns-interns target-ns)
10   - :when (:testable (meta var))]
11   - `(-> (def ~sym ~var)
12   - (alter-meta! merge (meta ~var)))))
  9 + (pile/macro-for [[sym var] (ns-interns target-ns)
  10 + :when (:testable (meta var))]
  11 + `(-> (def ~sym ~var)
  12 + (alter-meta! merge (meta ~var)))))
13 13
14 14 (defmacro testable-privates
15 15 "Intern into the current namespace the symbols from the specified namespace"
16 16 [namespace & symbols]
17   - (macro-for [sym symbols, :let [var (ns-resolve namespace sym)]]
18   - `(-> (def ~sym ~var)
19   - (alter-meta! merge
20   - (assoc (meta ~var)
21   - :testable true)))))
  17 + (pile/macro-for [sym symbols, :let [var (ns-resolve namespace sym)]]
  18 + `(-> (def ~sym ~var)
  19 + (alter-meta! merge
  20 + (assoc (meta ~var)
  21 + :testable true)))))
22 src/midje/util/form_utils.clj → src/midje/util/pile.clj
... ... @@ -1,11 +1,9 @@
1 1 (ns ^{:doc "Functions that are somewhat general purpose, but seem too obscure to be in midje.clojure.core.
2   - A placeholder for wiser decisions someday."}
3   - midje.util.form-utils
4   - (:use midje.clojure.core
5   - midje.parsing.util.core)
6   - (:require [clojure.zip :as zip]))
  2 + A cue to wiser placement decisions someday."}
  3 + midje.util.pile
  4 + (:use midje.clojure.core))
7 5
8   -;;; Maps
  6 + ;;; Maps
9 7
10 8 (defn tack-on-to
11 9 "Conj new values onto appropriate keys of a map"
@@ -18,7 +16,7 @@
18 16 (defn sort-map [m]
19 17 (into (sorted-map) m))
20 18
21   -;;; Sequences
  19 + ;;; Sequences
22 20
23 21 (defn apply-pairwise
24 22 "(apply-pairwise [inc dec] [1 1] [2 2]) => [ [2 0] [3 1] ]
@@ -29,8 +27,6 @@
29 27 functions)
30 28 arglists))
31 29
32   -
33   -
34 30 (defn pop-if
35 31 "Extracts optional arg (that we assume is present if the pred is true) from head of args"
36 32 [pred args]
@@ -48,9 +44,7 @@
48 44
49 45
50 46
51   -
52   -
53   -;;; Higher-order predicate helpers
  47 + ;;; Higher-order predicate helpers
54 48
55 49 (defn any-pred-from
56 50 "Returns a function that returns strictly true iff any
@@ -67,7 +61,7 @@
67 61 :else (recur remainder))))))
68 62
69 63
70   -;;; Definition helpers
  64 + ;;; Definition helpers
71 65
72 66 (defmacro macro-for
73 67 "Macroexpands the body once for each of the elements in the
@@ -85,5 +79,3 @@
85 79 `(defmethod ~name ~dval ~args
86 80 ~@body)))
87 81
88   -
89   -
19 test/midje/parsing/2_to_lexical_maps/t_examples.clj
... ... @@ -1,12 +1,11 @@
1 1 (ns midje.parsing.2-to-lexical-maps.t-examples
2   - (:use [clojure.test] ;; This is used to check production mode with deftest.
3   - [midje.sweet]
4   - [midje.parsing.2-to-lexical-maps.examples]
5   - [midje.util form-utils]
6   - [midje.test-util]
  2 + (:use clojure.test ;; This is used to check production mode with deftest.
  3 + midje.sweet
  4 + midje.parsing.2-to-lexical-maps.examples
  5 + midje.test-util
7 6 midje.util)
8   - (:require [clojure.zip :as zip]
9   - [midje.config :as config]
  7 + (:require [midje.config :as config]
  8 + [midje.util.pile :as pile]
10 9 [midje.emission.api :as emit]))
11 10 (expose-testables midje.parsing.2-to-lexical-maps.examples)
12 11
@@ -77,10 +76,10 @@
77 76
78 77 (fact "Note that lexical scoping is obeyed"
79 78 (count (:arg-matchers fake-1)) => 1
80   - (apply-pairwise (:arg-matchers fake-1) [5] [nil]) => [[true] [false]]
  79 + (pile/apply-pairwise (:arg-matchers fake-1) [5] [nil]) => [[true] [false]]
81 80 (count (:arg-matchers fake-2)) => 2
82   - (apply-pairwise (:arg-matchers fake-2) [5 5] [1 1]) => [ [false true]
83   - [true false] ])
  81 + (pile/apply-pairwise (:arg-matchers fake-2) [5 5] [1 1]) => [ [false true]
  82 + [true false] ])
84 83
85 84 (fact "Result supplied"
86 85 ((:result-supplier fake-0)) => 2
3  test/midje/test_util.clj
@@ -3,8 +3,7 @@
3 3 midje.checkers
4 4 [midje.checking.extended-equality :only [extended-=]]
5 5 [midje.checking.extended-falsehood :only [extended-false?]]
6   - midje.error-handling.exceptions
7   - [midje.util.form-utils :only [macro-for]])
  6 + midje.error-handling.exceptions)
8 7 (:require midje.clojure.core
9 8 [midje.config :as config]
10 9 [clojure.string :as str]
4 test/midje/util/t_form_utils.clj → test/midje/util/t_pile.clj
... ... @@ -1,5 +1,5 @@
1   -(ns midje.util.t-form-utils
2   - (:use [midje.util.form-utils])
  1 +(ns midje.util.pile
  2 + (:use [midje.util.pile])
3 3 (:use [midje.sweet])
4 4 (:use [midje.test-util]))
5 5

0 comments on commit 1c1ee9a

AlexBaranosky

Funnily enough, at Runa we have a analogous namespace called utils.homeless for all the things that don't have a home yet. Same principle there I think.

Please sign in to comment.
Something went wrong with that request. Please try again.