Liking cljdoc? Tell your friends :D

scicloj.note-to-test.v1.api


define-value-representations!clj

(define-value-representations! representations)

Define how values should be represented in the tests. The definition is a vector of maps, where each map has a predicate and a representation function. Each value is checked through the maps in order and represented by the representation function corresponding to the first predicate that applies to it.

Example:

(define-value-representations!
  [{:predicate #(> % 20)
    :representation (partial * 100)}
   {:predicate #(> % 10)
    :representation (partial * 10)}])

(represent-value 9) ; => 9, no predicate applies
(represent-value 19) ; => 190, second predicate applies
(represent-value 29) ; => 2900, first predicate applies
Define how values should be represented in the tests.
The definition is a vector of maps, where each map has a predicate and a representation function. Each value is checked through the maps in order and represented by the representation function corresponding to the first predicate that applies to it.

Example:
```clj
(define-value-representations!
  [{:predicate #(> % 20)
    :representation (partial * 100)}
   {:predicate #(> % 10)
    :representation (partial * 10)}])

(represent-value 9) ; => 9, no predicate applies
(represent-value 19) ; => 190, second predicate applies
(represent-value 29) ; => 2900, first predicate applies
```
raw docstring

gentest!clj

(gentest! source-path options)

Generate a clojure.test file for the code examples in the file at source-path.

Options:

  • accept - boolean - default false - should we accept overriding an existing test file which has changed?
  • verbose - boolean - default false - should we report whether an existing test file has changed?

Examples:

(gentest! "notebooks/dum/dummy.clj")
(gentest! "notebooks/dum/dummy.clj"
          {:accept true
           :verbose true})
Generate a clojure.test file for the code examples in the file at `source-path`.

Options:
- `accept` - boolean - default `false` - should we accept overriding an existing test file which has changed?
- `verbose` - boolean - default `false` - should we report whether an existing test file has changed?

Examples:
```clj
(gentest! "notebooks/dum/dummy.clj")
```
```clj
(gentest! "notebooks/dum/dummy.clj"
          {:accept true
           :verbose true})
```
 
raw docstring

gentests!clj

(gentests! dirs)
(gentests! dirs options)

Generate tests for all source files discovered in [dirs].

Options: like in gentest!.

Examples:

(gentests! ["notebooks"])
(gentests! ["notebooks"]
          {:accept true
           :verbose true})
Generate tests for all source files discovered in [dirs].

Options: like in `gentest!`.

Examples:
```clj
(gentests! ["notebooks"])
```
```clj
(gentests! ["notebooks"]
          {:accept true
           :verbose true})
```
raw docstring

represent-valueclj

(represent-value v)

Represent a given value v using the extensible definitions of special value representations.

Represent a given value `v` using the extensible definitions of special value representations.
raw docstring

represent-value-with-metaclj

(represent-value-with-meta v)

Represent a given value v, apply represent-value to both v and its metadata, and retorn both in one data structure.

Represent a given value `v`, apply `represent-value` to both `v` and its metadata, and retorn both in one data structure.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close