<< Back to previous view

[TCHECK-1] Namespace reorganization Created: 13/Feb/14  Updated: 17/Nov/14  Resolved: 17/Nov/14

Status: Resolved
Project: test.check
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Reid Draper Assignee: Reid Draper
Resolution: Declined Votes: 0
Labels: None


Currently test.check (and simple-check) use three separate namespaces: core, generators and properties. Bronsa has suggested renaming test.check.core to simply test.check. This has me wondering if the entire public API should be exported from just the 'test.check' namespace. This would mean users only need to import one namespace. Thoughts?

[1] https://github.com/clojure/test.check/commit/a2f270ae8e6fa99f337eaff6fbb2051a66dac392#commitcomment-5303415

Comment by Peter Taoussanis [ 28/Feb/14 11:01 AM ]

+1 I'd definitely welcome merging the namespaces. Even merged, the lot would be < 1000 loc - and the core namespace isn't much use w/o the other two.

Comment by Reid Draper [ 28/Feb/14 2:42 PM ]

I'd still like to keep them as separate files, if we do this. Any easy way to do that? Just declare the same namespace in each file?

Comment by Nicola Mometto [ 28/Feb/14 5:22 PM ]

Put the ns decl in the main file and then simply clojure.core/load the different files.

Comment by Bruce Adams [ 01/Mar/14 9:01 AM ]

Merging core and properties is fine, but I like having the generators in a separate namespace.

The complex part of my uses of test.check have been building generators. Having a clear name space for generators helps make my code easier to read. Here are some trivially small examples from my code:

(ns whatever.generators
  (:require (clojure.test.check [generators :as gen])))

(def gen-non-blank-string
  (gen/such-that #(not-empty (.trim %)) gen/string))

(defn gen-nil-or
  (gen/one-of [(gen/return nil) generator]))

(defn gen-set
  (gen/fmap set (gen/vector generator)))
Comment by Chas Emerick [ 03/Apr/14 7:52 AM ]

+1 to making the properties bits available in clojure.test.check. I've never been a fan of using load to separate namespaces into different files; var immigration is another option that could work.

I agree with Bruce that keeping the generators namespace separate is desirable.

Comment by Reid Draper [ 08/Apr/14 9:49 PM ]

Currently I'm thinking this is pretty low priority, given the other issues on the repo. Any disagreement?

Comment by Bruce Adams [ 09/Apr/14 7:19 AM ]

I agree, this is lower priority than its current "Major".

Generated at Sat Jan 20 03:50:56 CST 2018 using JIRA 4.4#649-r158309.