Liking cljdoc? Tell your friends :D

typed.clj.checker.test-utils


*remove-nsyms*clj

source

adjust-error-lines-for-markdownclj

(adjust-error-lines-for-markdown test-file-content type-errors)

Adjust error line numbers from test file to markdown code block. The test file has namespace declaration and comments before the markdown code. We need to find where the markdown code starts and adjust accordingly.

Adjust error line numbers from test file to markdown code block.
The test file has namespace declaration and comments before the markdown code.
We need to find where the markdown code starts and adjust accordingly.
sourceraw docstring

both-sub?cljmacro

(both-sub? s t)
source

both-subtype?clj

(both-subtype? s t)
source

caught-top-level-errorscljmacro

(caught-top-level-errors nfn & body)
source

checkclj

(check & as)
source

check-optclj

(check-opt opt)
source

cljcljmacro

(clj & body)
source

clj-optsclj

(clj-opts)
source

cljscljmacro

(cljs & body)
source

compare-versionsclj

(compare-versions v1 v2)

Compare two version strings. Returns :equal, :left-newer, or :right-newer

Compare two version strings. Returns :equal, :left-newer, or :right-newer
sourceraw docstring

create-error-markerclj

(create-error-marker start-line start-column end-line end-column)

Create visual error markers for an error. start-column and end-column are 1-indexed positions in the code line. Returns a map with :start-line-marker and :end-line-marker strings.

Create visual error markers for an error.
start-column and end-column are 1-indexed positions in the code line.
Returns a map with :start-line-marker and :end-line-marker strings.
sourceraw docstring

default-typeclj

source

doc-test-file-pathclj

(doc-test-file-path {:keys [id type] :as metadata} doc-name)

Generate test file path from metadata.

Generate test file path from metadata.
sourceraw docstring

enrich-code-with-errorsclj

(enrich-code-with-errors code type-errors)
(enrich-code-with-errors code type-errors test-file-content)

Enrich code with visual error markers and messages. Takes code string and list of type-errors from result. Optionally takes test-file-content to adjust line numbers. Returns enriched code string.

Enrich code with visual error markers and messages.
Takes code string and list of type-errors from result.
Optionally takes test-file-content to adjust line numbers.
Returns enriched code string.
sourceraw docstring

equal-typescljmacro

(equal-types l r)
source

equal-types-noparsecljmacro

(equal-types-noparse l r)
source

eretcljmacro

(eret f)
source

etycljmacro

(ety f)
source

expand-tabsclj

(expand-tabs s)

Expand tabs to spaces, assuming 8-character tab stops

Expand tabs to spaces, assuming 8-character tab stops
sourceraw docstring

extract-betweenclj

(extract-between lines start end)

Extract content between start and end delimiters in a vector of lines.

Extract content between start and end delimiters in a vector of lines.
sourceraw docstring

extract-error-messagesclj

(extract-error-messages tc-err-res)
source

extract-namespace-from-fileclj

(extract-namespace-from-file content)

Extract namespace from file content

Extract namespace from file content
sourceraw docstring

format-doc-test-metadataclj

(format-doc-test-metadata metadata target)

Format metadata for insertion into file. target: :markdown or :clojure

Format metadata for insertion into file.
target: :markdown or :clojure
sourceraw docstring

format-error-messageclj

(format-error-message message)

Format the error message as comment lines, expanding tabs to spaces

Format the error message as comment lines, expanding tabs to spaces
sourceraw docstring

generate-doc-test-file-contentclj

(generate-doc-test-file-content metadata code result doc-name)

Generate complete test file content

Generate complete test file content
sourceraw docstring

generate-doc-test-namespaceclj

(generate-doc-test-namespace doc-name id)

Generate a namespace name from doc name and id.

Generate a namespace name from doc name and id.
sourceraw docstring

generate-uuidclj

(generate-uuid)

Generate a short UUID for code block identification

Generate a short UUID for code block identification
sourceraw docstring

is-cfcljmacro

(is-cf & args)
source

is-cljcljmacro

(is-clj & args)
source

is-tc-ecljmacro

(is-tc-e & body)
source

is-tc-errcljmacro

(is-tc-err & body)

Returns the result of the tc-err call

Returns the result of the tc-err call
sourceraw docstring

is-tc-err-messagescljmacro

(is-tc-err-messages & body)

Performs an is-tc-err and returns error messages

Performs an is-tc-err and returns error messages
sourceraw docstring

is-with-aliasescljmacro

(is-with-aliases tst)
source

parse-code-blocksclj

(parse-code-blocks markdown-content)

Extract code blocks from markdown with their metadata.

Extract code blocks from markdown with their metadata.
sourceraw docstring

parse-doc-test-fileclj

(parse-doc-test-file file-path)

Parse a test file, extracting metadata, code, and expected result. Returns nil if file doesn't exist.

Parse a test file, extracting metadata, code, and expected result.
Returns nil if file doesn't exist.
sourceraw docstring

parse-doc-test-metadataclj

(parse-doc-test-metadata text)

Parse metadata from comment lines. Format: <!-- doc-test: key=value key=value --> or: ;; doc-test: key=value key=value

Parse metadata from comment lines.
Format: <!-- doc-test: key=value key=value -->
or:     ;; doc-test: key=value key=value
sourceraw docstring

pprint-strclj

(pprint-str data)

Pretty-print data structure to string with deterministic sorting

Pretty-print data structure to string with deterministic sorting
sourceraw docstring

read-form-extentclj

(read-form-extent code start-line start-column)

Read a form from code at the given line and column, using read+string to determine the extent. Returns {:end-line :end-column :form-string} or nil.

Read a form from code at the given line and column, using read+string
to determine the extent. Returns {:end-line :end-column :form-string} or nil.
sourceraw docstring

should-not-reflectcljmacro

(should-not-reflect form)

Turn on all warning flags, and test that reflection does not occur (as identified by messages to err).

Turn on all warning flags, and test that reflection does not occur
(as identified by messages to *err*).
sourceraw docstring

sort-data-structureclj

(sort-data-structure data)

Recursively sort maps and sets for deterministic output

Recursively sort maps and sets for deterministic output
sourceraw docstring

sub?cljmacro

(sub? s t)
source

sub?-qcljmacro

(sub?-q s t)
source

subtype?clj

(subtype? s t)
source

sync-all-docsclj

(sync-all-docs)

Sync all documentation files

Sync all documentation files
sourceraw docstring

sync-code-blockclj

(sync-code-block block doc-name)

Synchronize a single code block with its test file. Returns updated block or nil if no changes needed.

Synchronize a single code block with its test file.
Returns updated block or nil if no changes needed.
sourceraw docstring

sync-doc-fileclj

(sync-doc-file doc-file)

Synchronize a single documentation file

Synchronize a single documentation file
sourceraw docstring

tccljmacro

(tc form)
source

tc-common*clj

(tc-common* frm
            {{:keys [syn provided?]} :expected-syntax
             :keys [expected-ret requires ns-meta check-config]
             :as opt})
source

tc-ecljmacro

(tc-e frm & opts)

Type check an an expression in namespace that :refer's all of clojure.core.typed (aliased to t) and aliases clojure.core to core.

Takes one form and then options, and returns true if the form checks with the expected input/output types according to the provided options.

The first form in the options can be a static type syntax scoped in the new namespace. This is disambiguated with a call to keyword? (literal keywords aren't valid type syntax).

eg. (tc-e (+ 1 1) Num) ;=> Num

Keyword Options:

:expected-ret An expected ret, evaluated in the current namespace (not the new one that refers c.c.t). Cannot be provided in combination with the implicit first option as a type, as above. :ret Check the return TCResult of this expression against this ret. Evaluated in the current namespace. :ns-meta Map to use as ns metadata. :check-config Map specifying check-config.

Type check an an expression in namespace that :refer's
all of clojure.core.typed (aliased to t) and aliases clojure.core
to core.

Takes one form and then options, and returns true if the form checks
with the expected input/output types according to the provided options.

The first form in the options can be a static type syntax scoped
in the new namespace. This is disambiguated with a call to keyword?
(literal keywords aren't valid type syntax).

eg. (tc-e (+ 1 1) Num)
    ;=> Num

Keyword Options:

  :expected-ret An expected ret, evaluated in the current namespace (not the new
                one that refers c.c.t). Cannot be provided in combination with the implicit
                first option as a type, as above.
  :ret          Check the return TCResult of this expression against this ret. Evaluated
                in the current namespace.
  :ns-meta      Map to use as ns metadata.
  :check-config Map specifying check-config.
sourceraw docstring

tc-errcljmacro

(tc-err frm & opts)
source

tc-tcljmacro

(tc-t form)
source

test-dirclj

source

throws-tc-error?cljmacro

(throws-tc-error? & body)
source

update-markdownclj

(update-markdown original-content blocks)

Update markdown content with synchronized code blocks

Update markdown content with synchronized code blocks
sourceraw docstring

with-delayed-remove-nscljmacro

(with-delayed-remove-ns & body)
source

with-err-print-writercljmacro

(with-err-print-writer & body)

Evaluate with err pointing to a temporary PrintWriter, and return err contents as a string.

Evaluate with err pointing to a temporary PrintWriter, and
return err contents as a string.
sourceraw docstring

with-err-string-writercljmacro

(with-err-string-writer & body)

Evaluate with err pointing to a temporary StringWriter, and return err contents as a string.

Evaluate with err pointing to a temporary StringWriter, and
return err contents as a string.
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