Skip to main content

test.selector

Jump to function (9)

test.selector/has-selectors?#

(has-selectors? options)

Returns true when options contains at least one non-empty selector key.

Example:

(has-selectors? {:include [:integration]})

test.selector/has-tag?#

(has-tag? meta tag)

Returns true when meta carries tag (a keyword or a string treated as a keyword). Single-keyword metadata (^:integration) and map-based multi-tag metadata (^{:tags [:integration :slow]}) both match.

Example:

(has-tag? {:integration true} :integration)

test.selector/keep-test?#

(keep-test? options ns-name meta)

Returns true when the test described by meta and ns-name should be run under options. options is a map that may carry any of :include, :exclude, :ns-patterns, :filters. Selectors that are absent or empty impose no restriction; specified selectors are AND'd together.

Example:

(keep-test? {:include [:integration]} "my.ns" {:integration true :test-name "t"})

test.selector/matches-exclude?#

(matches-exclude? excludes meta)

Returns true when any tag in excludes is truthy on meta. An empty or nil excludes vector always returns false (nothing excluded).

Example:

(matches-exclude? [:slow] {:slow true})

test.selector/matches-filter?#

(matches-filter? patterns test-name)

Returns true when patterns is empty (no restriction) or when any entry in patterns matches test-name.

Example:

(matches-filter? ["add-"] "test-add-one")

test.selector/matches-include?#

(matches-include? includes meta)

Returns true when includes is empty (no restriction) or when any tag in includes is truthy on meta.

Example:

(matches-include? [:integration] {:integration true})

test.selector/matches-ns?#

(matches-ns? patterns ns-name)

Returns true when patterns is empty (no restriction) or when any glob in patterns matches ns-name.

Example:

(matches-ns? ["phel.http.*"] "phel.http.client")

test.selector/name-matches?#

(name-matches? pattern test-name)

Returns true when pattern (a PCRE /.../ string or a plain substring) matches test-name.

Example:

(name-matches? "add-" "test-add-one")

test.selector/ns-matches?#

(ns-matches? pattern ns-name)

Returns true when ns-name matches the glob pattern. Supports * (single segment) and ** (any run). Backslash-separated namespaces (phel\http\client) are treated as dotted (phel.http.client) so globs stay portable.

Example:

(ns-matches? "phel.http.*" "phel\\http\\client")