   "Defines a test suite containing other test cases or suites.
   decl => docstring? [context*] children*"
   [name & decl]
-  (let [m {:name name}
+  (let [m {:name name, :ns *ns*}
         m (if (string? (first decl)) (assoc m :doc (first decl)) m)
         decl (if (string? (first decl)) (next decl) decl)
         contexts (first decl)

    (let [active (reduce close-context active (:parents c))]
      (dissoc active c))))

;; (let [m {:name name}
;;         m (if (string? (first decl)) (assoc m :doc (first decl)) m)
;;         decl (if (string? (first decl)) (next decl) decl)
;;         bindings (first decl)
;;         assertions (next decl)]
;;     (assert (vector? bindings))
;;     (assert (even? (count bindings)))
;;     (let [locals (vec (map first (partition 2 bindings)))
;;           contexts (vec (map (comp coerce-context second) (partition 2 bindings)))]
;;       (assert (every? symbol locals))
;;       `(def ~name
;;             (with-meta (TestCase ~contexts
;;                                  ~(loop [r [], as assertions]
;;                                     (if (seq as)
;;                                       (if (string? (first as))
;;                                         (recur (conj r `(with-meta (assertion ~locals ~(next as))
;;                                                           {:doc ~(first as)}))
;;                                                (nnext as))
;;                                         (recur (conj r `(assertion ~locals ~(first as))) (next as)))
;;                                       r)))
;;               '~m))))

(defmacro defcontext
  "Defines a context.
  decl => docstring? [bindings*] before-body* (:after [state] after-body*)?"
  [name & decl]
  (let [m {:name name}
        m (if (string? (first decl)) (assoc m :doc (first decl)) m)
        decl (if (string? (first decl)) (next decl) decl)
        bindings (first decl)

(defsuite t11 "Suite t11" [c4 c5] t9 t10)

(assert (= 't11 (:name (meta t11))))
(assert (= *ns* (:ns (meta t11))))
(assert (= "Suite t11" (:doc (meta t11))))
(assert (= ::TestCase (type t11)))
(assert (= [c4 c5] (:contexts t11)))
