 (defn- validate-opts
   [opts]
   (assert (every? ident? (keys (:gen opts))) "test :gen expects ident keys"))
+
+(defn syms-to-test
+  "Returns a coll of registered syms matching ns-or-names (a symbol or
+collection of symbols).
+
+A symbol matches ns-or-names if ns-or-names includes either the symbol
+itself or the symbol's namespace symbol.
+
+If no ns-or-names specified, returns all registered syms."
+  ([] (sequence
+       (filter symbol?)
+       (keys (s/registry))))
+  ([ns-or-names]
+     (let [match? (sym-matcher (collectionize ns-or-names))]
+       (sequence
+        (comp (filter symbol?)
+              (filter match?))
+        (keys (s/registry))))))
 
 (defn test-fn
   "Runs generative tests for fn f using spec and opts. See

:no-gen     unable to generate :args
:no-fn      unable to resolve fn to test
"
  ([sym-or-syms] (test sym-or-syms nil))
  ([sym-or-syms opts]
     (validate-opts opts)
     (->> (eduction
           (map sym->test-map)
           (collectionize sym-or-syms))
          (pmap #(test-1 % opts)))))

(defn test-ns
  "Like test, but scoped to specific namespaces, or to
*ns* if no arg specified."
  ([] (test-ns (.name ^clojure.lang.Namespace *ns*)))
  ([ns-or-nses] (test-ns ns-or-nses nil))
  ([ns-or-nses opts]
     (validate-opts opts)
     (let [ns-match? (ns-matcher (collectionize ns-or-nses))]
       (->> (eduction
             (filter symbol?)
             (filter ns-match?)
             (map sym->test-map)
             (keys (s/registry)))
            (pmap #(test-1 % opts))))))

(defn test-all
  "Like test, but tests all vars named by fn-specs in the spec
registry."
  ([] (test-all nil))
  ([opts]
     (validate-opts opts)
     (->> (eduction
           (filter symbol?)
           (map sym->test-map)
           (keys (s/registry)))
          (pmap #(test-1 % opts)))))

(defn abbrev-result
  "Given a test result, returns an abbreviated version

    (list x)
    x))

(defn- sym-matcher
  "Returns a fn that matches symbols that are either in syms,
or whose namespace is in syms."
  [syms]
  (let [names (into #{} (map str) syms)]
    (fn [s]
      (or (contains? names (namespace s))
          (contains? names (str s))))))

(defn- sym->test-map
  [s]
