Liking cljdoc? Tell your friends :D

hegel-clj.core

The ain API for hegel-clj.

The ain API for hegel-clj.
raw docstring

*client*clj

We make the client accessible as a dynamic variable, so that generators can access it without having to thread arguments through every phase of generation.

We make the client accessible as a dynamic variable, so that generators can
access it without having to thread arguments through every phase of
generation.
sourceraw docstring

*test-case-stream-id*clj

As another convenience, we store the current test case stream ID so you don't have to thread it between test cases and calls to generate.

As another convenience, we store the current test case stream ID so you
don't have to thread it between test cases and calls to generate.
sourceraw docstring

clientclj

As a convenience, we keep a global client around and automatically spin it upon the first request.

As a convenience, we keep a global client around and automatically spin it upon the first request.
sourceraw docstring

collection-more?clj

(collection-more? collection-id)

See client/collection-more?

See client/collection-more?
sourceraw docstring

collection-reject!clj

(collection-reject! collection-id)

See client/collection-reject!

See client/collection-reject!
sourceraw docstring

final?clj

(final?)

Returns true iff we're in the final pass of a test case.

Returns true iff we're in the final pass of a test case.
sourceraw docstring

finfocljmacro

(finfo & args)

Logging macro. Calls core.logging/info, but only when in a final test run.

Logging macro. Calls core.logging/info, but only when in a final test
run.
sourceraw docstring

fpprintcljmacro

(fpprint & args)

Like clojure pprint, but only when in a final test run.

Like clojure pprint, but only when in a final test run.
sourceraw docstring

fprncljmacro

(fprn & args)

Like clojure prn, but only when in a final test run.

Like clojure prn, but only when in a final test run.
sourceraw docstring

fwarncljmacro

(fwarn & args)

Logging macro. Calls core.logging/warn, but only when in a final test run.

Logging macro. Calls core.logging/warn, but only when in a final test
run.
sourceraw docstring

genclj

(gen schema)

Generates a random value from the provided schema. Use hegel-clj.gen to construct a schema, like so:

(gen (gen/one-of (gen/boolean) (gen/integer)))
Generates a random value from the provided schema. Use `hegel-clj.gen` to
construct a schema, like so:

    (gen (gen/one-of (gen/boolean) (gen/integer)))
sourceraw docstring

gen-global-span-type!clj

(gen-global-span-type!)

Generates a new global span. This is available at macroexpand time.

Generates a new global span. This is available at macroexpand time.
sourceraw docstring

gen-span-type!clj

(gen-span-type!)

Returns a fresh span type for the current client.

Returns a fresh span type for the current client.
sourceraw docstring

new-collection!clj

(new-collection! opts)

See client/new-collection!

See client/new-collection!
sourceraw docstring

next-global-span-typeclj

The Core can generate span types, but we can also generate them globally (e.g. at macroexpand time). We use this in g/let to start spans. Global spans are negative.

The Core can generate span types, but we can also generate them globally
(e.g. at macroexpand time). We use this in g/let to start spans. Global spans
are negative.
sourceraw docstring

run-test!cljmacro

(run-test! opts & body)

Macro form of run-test!*; takes a body, rather than a function.

Macro form of run-test!*; takes a body, rather than a function.
sourceraw docstring

run-test!*clj

(run-test!* opts case-fn)

Runs a test. This version is more functional; for a more convenient, stateful version, use deftest. Options are:

:test-cases     The number of test cases to run
:seed           A random seed
:derandomize    If true, and seed is not set, derives a deterministic
                seed from database-key
:database-key   A stable database key for this test
:database       A path to the DB directory
:suppress-health-check  A vector of health check keywords to suppress:
                        any of :test-cases-too-large, :filter-too-much,
                        :too-slow, :large-initial-test-case

Takes a function (case-fn) which will be invoked approximately test-cases times, with zero arguments. This function can call (gen/int) etc. to generate values, and should return a map which explains whether the case was valid or not:

{:status :valid}
{:status :invalid}
{:status :interesting
 :origin "..."}

Returns a map describing the results of the test, of the form:

:passed?                Did all tests pass?)
:test-cases             How many test cases were executed?
:valid-test-cases       How many of them were valid
:invalid-test-cases     How many of them were invalid
:interesting-test-cases How many of them were interesting (e.g. a bug)
:seed                   The random seed used
:flaky?                 Hegel thought this test was non-deterministic
:health-check-failure?  Did a health check fail during the test?

May also throw an exception map like {:type :hegel-error, :message "..."}.

Runs a test. This version is more functional; for a more convenient,
stateful version, use deftest. Options are:

    :test-cases     The number of test cases to run
    :seed           A random seed
    :derandomize    If true, and seed is not set, derives a deterministic
                    seed from database-key
    :database-key   A stable database key for this test
    :database       A path to the DB directory
    :suppress-health-check  A vector of health check keywords to suppress:
                            any of :test-cases-too-large, :filter-too-much,
                            :too-slow, :large-initial-test-case

Takes a function `(case-fn)` which will be invoked approximately `test-cases`
times, with zero arguments. This function can call `(gen/int)` etc. to
generate values, and should return a map which explains whether the case was
valid or not:

    {:status :valid}
    {:status :invalid}
    {:status :interesting
     :origin "..."}

Returns a map describing the results of the test, of the form:

    :passed?                Did all tests pass?)
    :test-cases             How many test cases were executed?
    :valid-test-cases       How many of them were valid
    :invalid-test-cases     How many of them were invalid
    :interesting-test-cases How many of them were interesting (e.g. a bug)
    :seed                   The random seed used
    :flaky?                 Hegel thought this test was non-deterministic
    :health-check-failure?  Did a health check fail during the test?

May also throw an exception map like {:type :hegel-error, :message "..."}.
sourceraw docstring

samplecljmacro

(sample n & body)

Evaluates body up to n times, returning a vector of results. Useful for debugging generators.

Evaluates body up to n times, returning a vector of results. Useful for
debugging generators.
sourceraw docstring

sample*clj

(sample* n f)

Samples up to n values from the provided function (f), which presumably calls gen. Helpful for debugging generators.

Samples up to `n` values from the provided function `(f)`, which presumably
calls `gen`. Helpful for debugging generators.
sourceraw docstring

start-span!clj

(start-span! span-type)

Starts a span of the given type on the current client.

Starts a span of the given type on the current client.
sourceraw docstring

stop-span!clj

(stop-span!)

Stops a span on the current client.

Stops a span on the current client.
sourceraw docstring

when-finalcljmacro

(when-final & body)

Evaluates body only if this is a final test case. Helpful for logging.

Evaluates body only if this is a final test case. Helpful for logging.
sourceraw docstring

with-spancljmacro

(with-span & body)

Evaluates body with a span. Generates a unique span type at macroexpand time.

Evaluates body with a span. Generates a unique span type at macroexpand
time.
sourceraw docstring

with-span*cljmacro

(with-span* span-type & body)

Evaluates body with a span of the given type. If the body throws, I'm not sure what to do; I'm going to try closing the span, but I imagine that's probably asking for trouble sometimes.

Evaluates body with a span of the given type. If the body throws, I'm not
sure *what* to do; I'm going to try closing the span, but I imagine that's
probably asking for trouble sometimes.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close