Skip to content

Commit c4b544f

Browse files
committed
sweeping the floor
1 parent f6e951a commit c4b544f

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

notes

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
(it "finds the tests in the runner_tests folder"
44
(expect (find-tests "./runner_tests")
5-
to (be_empty) <<<<<<<< ??????
5+
to (be :empty) <<<<<<<< ??????
66
to (equal '("suite_one.clj")))))
77

8-
- Assertion failures should report the line number they're failing on
8+
- Assertion failures should report the line number they're failing on

probe.jar

6 Bytes
Binary file not shown.

src/probe/core.clj

+22-19
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,14 @@
33
(use 'probe.runner)
44
(use 'clojure.contrib.seq-utils)
55

6-
(defmulti pending-for-type :type)
7-
8-
(defmethod pending-for-type :context [context]
9-
(let [tests (:tests context)]
10-
(if (empty? tests)
11-
true
12-
(find-first pending-for-type tests))))
13-
14-
(defmethod pending-for-type :test [test]
15-
(empty? (:tests test)))
16-
17-
(defmethod pending-for-type :expects [test]
18-
(empty? (:tests test)))
19-
20-
(defn is-pending [coll]
21-
(let [result (find-first pending-for-type (flatten [coll]))]
22-
(not (or (nil? result) (empty? result)))))
6+
;; The two default data structures are defined below
7+
;; Everything is stored as either a context or a test.
238

249
(defstruct context-info
2510
:type
2611
:doc
2712
:tests)
2813

29-
;; TODO: There has to be a reasonable way to do this
30-
;; in clojure
3114
(def default-context
3215
(struct-map context-info
3316
:type :context
@@ -40,6 +23,26 @@
4023
:doc ""
4124
:tests []))
4225

26+
(defmulti pending-for-type :type)
27+
28+
(defmethod pending-for-type :context [context]
29+
(let [tests (:tests context)]
30+
(if (empty? tests)
31+
true
32+
(find-first pending-for-type tests))))
33+
34+
(defmethod pending-for-type :test [test]
35+
(empty? (:tests test)))
36+
37+
(defmethod pending-for-type :expects [test]
38+
(empty? (:tests test)))
39+
40+
(defn is-pending [coll]
41+
(let [result (find-first pending-for-type (flatten [coll]))]
42+
(not (or (nil? result)
43+
(empty? result)))))
44+
45+
4346
(defn context
4447
([doc] (assoc default-context :doc doc))
4548
([doc & children]

0 commit comments

Comments
 (0)