Clojure 1.9.0-alpha8 is now available.
Try it via
- Dependency: [org.clojure/clojure "1.9.0-alpha8"]
1.9.0-alpha8 includes the following changes since 1.9.0-alpha7:
The collection spec support has been greatly enhanced, with new controls for conforming, generation, counts, distinct elements and collection kinds. See the docs for every, every-kv, coll-of and map-of for details.
instrumenting and testing has been streamlined and made more composable, with powerful new features for spec and gen overrides, stubbing, and mocking. See the docs for these functions in clojure.spec.test: instrument, test, enumerate-ns and summarize-results.
Namespaced keyword reader format, printing and destructuring have been enhanced for lifting namespaces up for keys, supporting more succinct use of fully-qualified keywords. Updated docs will be added to
clojure.org soon.
Many utilities have been added, for keys spec merging, fn exercising, Java 1.8 timestamps, bounded-count and more.
Changelog:
clojure.spec:
- [changed] map-of - now conforms all values and optionally all keys, has additional kind, count, gen options
- [changed] coll-of - now conforms all elements, has additional kind, count, gen options. No longer takes init-coll param.
- [added] every - validates a collection by sampling, with many additional options
- [added] every-kv - validates a map by sampling, with many additional options
- [added] merge
- [changed] gen overrides can now be specified by either name or path
- [changed] fspec generator - creates a function that generates return values according to the :ret spec and ignores :fn spec
- [added] explain-out - produces an explain output string from an explain-data result
- [changed] explain-data - output is now a vector of problems with a :path element, not a map keyed by path
- [added] get-spec - for looking up a spec in the registry by keyword or symbol
- [removed] fn-spec - see get-spec
- [added] exercise-fn - given a spec'ed function, returns generated args and the return value
- All instrument functions moved to clojure.spec.test
clojure.spec.test:
- [changed] instrument - previously took a var, now takes either a symbol, namespace symbol, or a collection of symbols or namespaces, plus many new options for stubbing or mocking. Check the docstring for more info.
- [removed] instrument-ns - see instrument
- [removed] instrument-all - see instrument
- [changed] unstrument - previously took a var, now takes a symbol, namespace symbol, or collection of symbol or namespaces
- [removed] unstrument-ns - see unstrument
- [removed] unstrument-all - see unstrument
- [added] instrumentable-syms - syms that can be instrumented
- [added] with-instrument-disabled - disable instrument's checking of calls within a scope
- [changed] check-var renamed to test and has a different signature, check docs
- [changed] run-tests - see test
- [changed] run-all-tests - see test
- [changed] check-fn - renamed to test-fn
- [added] abbrev-result - returns a briefer description of a test
- [added] summarize-result - returns a summary of many tests
- [added] testable-syms - syms that can be tested
- [added] enumerate-namespace - provides symbols for vars in namespaces
clojure.core:
- [changed] - inst-ms now works with java.time.Instant instances when Clojure is used with Java 8
- [added] bounded-count - if coll is counted? returns its count, else counts at most first n elements of coll using its seq