Liking cljdoc? Tell your friends :D

cli4clj.cli-tests

Helper functions for testing CLIs.

Helper functions for testing CLIs.
raw docstring

cmd-vector-to-test-input-stringclj

(cmd-vector-to-test-input-string cmd-vec)

This function takes a vector of string commands and creates a one-line command that is suited to being passed to a cli instance during testing.

This function takes a vector of string commands and creates a one-line command that is suited to being passed to a cli instance during testing.
raw docstring

create-repl-read-test-fnclj

(create-repl-read-test-fn opts)

This function creates a repl read function for testing.

This function creates a repl read function for testing.
raw docstring

exec-tested-fnclj

(exec-tested-fn tested-fn)

This function takes another function as argument and executes it in a way that is suited for testing.

This function takes another function as argument and executes it in a way that is suited for testing.
raw docstring

expected-stringclj

(expected-string expected-lines)
(expected-string expected-lines separator)

Takes a vector of strings that are intended to represent individual lines of expected command line output and converts them into a string that can be compared against the output of the test-cli-stdout and test-cli-stderr functions. The most notably property is that the lines are joined based on the platform dependent line.separator.

Takes a vector of strings that are intended to represent individual lines of expected command line output and converts them into a string that can be compared against the output of the test-cli-stdout and test-cli-stderr functions.
The most notably property is that the lines are joined based on the platform dependent line.separator.
raw docstring

string-latchclj

(string-latch sl-defs)

A string-latch can be used for testing CLI UI interaction with multi-threaded behaviour.

The latch takes a vector of string-latch definitions (sl-defs). Each string-latch definition defines a "wait" point, which will block the execution of the main CLI UI test thread until the string-latch definition was matched in the CLI output. When multiple string-latch definitions are configured in the vector, the definitions have to be matched in the CLI output in the order in which they are defined in the sl-defs vector.

A string-latch definition can either be a string or a two element vector of a string and a function. When only a string is used, the latch will simply await the occurrence of the string in the CLI output. When the two element vector is used, the latch will wait for the occurrence of the string and will call the function once the string was matched. Both representations, string and string plus function vector, can be mixed in the overall string-latch definitions vector.

A string-latch can be used for testing CLI UI interaction with multi-threaded behaviour.

The latch takes a vector of string-latch definitions (sl-defs).
Each string-latch definition defines a "wait" point, which will block the execution of the main CLI UI test thread until the string-latch definition was matched in the CLI output.
When multiple string-latch definitions are configured in the vector, the definitions have to be matched in the CLI output in the order in which they are defined in the sl-defs vector.

A string-latch definition can either be a string or a two element vector of a string and a function.
When only a string is used, the latch will simply await the occurrence of the string in the CLI output.
When the two element vector is used, the latch will wait for the occurrence of the string and will call the function once the string was matched.
Both representations, string and string plus function vector, can be mixed in the overall string-latch definitions vector.
raw docstring

test-cli-stderrclj

(test-cli-stderr tested-fn in-cmds)
(test-cli-stderr tested-fn in-cmds sl)

Takes a function to be tested and a vector of string input commands and returns the string that was printed to stderr as a result of executing the supplied commands in the cli provided by the tested-fn.

If an optional string-latch is supplied, the call will block until the string-latch completed.

Takes a function to be tested and a vector of string input commands and returns the string that was printed to stderr as a result of executing the supplied commands in the cli provided by the tested-fn.

If an optional string-latch is supplied, the call will block until the string-latch completed.
raw docstring

test-cli-stderr-cbclj

(test-cli-stderr-cb tested-fn in-cmds cb-fn)

Takes a function to be tested and a vector of string input commands and returns the string that was printed to stdout as a result of executing the supplied commands in the cli provided by the tested-fn. In addition the function cb-fn will be called for each element that is written to stderr.

Takes a function to be tested and a vector of string input commands and returns the string that was printed to stdout as a result of executing the supplied commands in the cli provided by the tested-fn.
In addition the function cb-fn will be called for each element that is written to stderr.
raw docstring

test-cli-stdoutclj

(test-cli-stdout tested-fn in-cmds)
(test-cli-stdout tested-fn in-cmds sl)

Takes a function to be tested and a vector of string input commands and returns the string that was printed to stdout as a result of executing the supplied commands in the cli provided by the tested-fn.

If an optional string-latch is supplied, the call will block until the string-latch completed.

Takes a function to be tested and a vector of string input commands and returns the string that was printed to stdout as a result of executing the supplied commands in the cli provided by the tested-fn.

If an optional string-latch is supplied, the call will block until the string-latch completed.
raw docstring

test-cli-stdout-cbclj

(test-cli-stdout-cb tested-fn in-cmds cb-fn)

Takes a function to be tested and a vector of string input commands and returns the string that was printed to stdout as a result of executing the supplied commands in the cli provided by the tested-fn. In addition the function cb-fn will be called for each element that is written to stdout.

Takes a function to be tested and a vector of string input commands and returns the string that was printed to stdout as a result of executing the supplied commands in the cli provided by the tested-fn.
In addition the function cb-fn will be called for each element that is written to stdout.
raw docstring

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

× close