Liking cljdoc? Tell your friends :D

rct-clr.gen

Generates CLR-compatible test files from ^:rct/test blocks. Run via: clojure -M -m rct-clr.gen --help

Generates CLR-compatible test files from ^:rct/test blocks.
Run via: clojure -M -m rct-clr.gen --help
raw docstring

-mainclj

(-main & args)
source

build-resolverclj

(build-resolver ns-sym)

Build a rewrite-clj auto-resolve map for a loaded namespace.

Build a rewrite-clj auto-resolve map for a loaded namespace.
sourceraw docstring

cli-optionsclj

source

datum->formclj

(datum->form {:keys [test-sexpr expectation-type] :as datum} ns-sym output-ns)

Convert an RCT datum to a Clojure form for the generated test. A => expectation lands in code position, as RCT emits it.

Convert an RCT datum to a Clojure form for the generated test.
A => expectation lands in code position, as RCT emits it.
sourceraw docstring

file->ns-symclj

(file->ns-sym file)

Get namespace symbol from a source file.

Get namespace symbol from a source file.
sourceraw docstring

file->rct-blocksclj

(file->rct-blocks file ns-sym)

Extract RCT test data from a file, grouped by ^:rct/test block. Namespace must already be loaded. Returns a seq of seqs (one per comment block).

Extract RCT test data from a file, grouped by ^:rct/test block.
Namespace must already be loaded.
Returns a seq of seqs (one per comment block).
sourceraw docstring

find-source-filesclj

(find-source-files dir)

Find all .clj and .cljc files in dir, keeping the .cljc when a namespace is present as both.

Find all .clj and .cljc files in dir, keeping the .cljc when a namespace is
present as both.
sourceraw docstring

generateclj

(generate {:keys [src-dirs output namespace]})

Scan source directories for ^:rct/test blocks and write the generated test file. Returns {:namespaces n :blocks n} on success. Throws ex-info if a namespace fails to load.

Scan source directories for ^:rct/test blocks and write the generated
test file. Returns {:namespaces n :blocks n} on success.
Throws ex-info if a namespace fails to load.
sourceraw docstring

ns-sym->test-baseclj

(ns-sym->test-base ns-sym)

Convert namespace symbol to base name for tests.

Convert namespace symbol to base name for tests.
sourceraw docstring

read-expectationclj

(read-expectation {:keys [expectation-string expectation-type]} ns-sym)

Read expectation string into a form, handling ellipses for =>>.

Read expectation string into a form, handling ellipses for =>>.
sourceraw docstring

resolve-reader-conditionalsclj

(resolve-reader-conditionals form ns-sym)

Post-process a form from z/sexpr to resolve reader conditionals for CLR. rewrite-clj wraps unresolved #? forms as (read-string "#?(...)"), so this walks the tree and resolves them with :features #{:cljr}.

Post-process a form from z/sexpr to resolve reader conditionals for CLR.
rewrite-clj wraps unresolved #? forms as (read-string "#?(...)"), so this
walks the tree and resolves them with :features #{:cljr}.
sourceraw docstring

validate-optsclj

(validate-opts args)

Parse and validate CLI options. Returns a tagged map: {:ok {:src-dirs [...] :output "..." :namespace "..."}} on success, {:help summary-string} for -h, {:errors ["msg" ...]} on failure.

Parse and validate CLI options. Returns a tagged map:
{:ok {:src-dirs [...] :output "..." :namespace "..."}} on success,
{:help summary-string} for -h, {:errors ["msg" ...]} on failure.
sourceraw docstring

write-block-fnclj

(write-block-fn w fn-sym block-data ns-sym file output-ns)

Write a defn- for a single ^:rct/test block, one run-form! call per line. Each form is quoted and eval'd by run-form!, so it resolves in the source namespace at test time, not the generated test namespace.

Write a defn- for a single ^:rct/test block, one run-form! call per line.
Each form is quoted and eval'd by run-form!, so it resolves in the source
namespace at test time, not the generated test namespace.
sourceraw docstring

write-deftestclj

(write-deftest w ns-sym block-infos)

Write a deftest that calls block fns in order. Binds ns to the source namespace so eval'd forms resolve there, and the REPL vars so bind-repl-vars! has a thread-local to set!.

Write a deftest that calls block fns in order.
Binds *ns* to the source namespace so eval'd forms resolve there, and the
REPL vars so bind-repl-vars! has a thread-local to set!.
sourceraw docstring

write-preambleclj

(write-preamble w output-ns ns-syms)

Write the ns form and the helpers the generated tests call. The ns is tagged ^:clr-only so Kaocha skips it on the JVM.

Write the ns form and the helpers the generated tests call.
The ns is tagged ^:clr-only so Kaocha skips it on the JVM.
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