Use the -p|--pattern PATTERN option to restrict which tests are executed. Patterns are awk expressions evaluated against the test hierarchy.
How patterns work
When evaluating a pattern, Tasty provides the following fields:
$0: The full test name (all groups and the test name concatenated with .).$1, $2, ... $NF: Individual components of the hierarchy (outermost group is $1, the test's own name is $NF).NF: The total number of components in the hierarchy.
Example Hierarchy
For a test defined as:
testGroup "One" [ testGroup "Two" [ testCase "Three" _ ] ]
The fields are:
$0 = "One.Two.Three"$1 = "One"$2 = "Two"$3 = "Three"NF = 3
Common Pattern Examples
foo: Shortcut for /foo/ (matches foo anywhere in $0).$2 == "Two": Selects the subgroup named "Two".$0 !~ /skip/: Selects tests whose full name does not contain "skip".$NF !~ /skip/: Selects tests whose own name (not group name) does not contain "skip".$(NF-1) ~ /QuickCheck/: Selects tests whose immediate parent group name contains "QuickCheck".
Supported Operators and Functions
Tasty supports standard awk operators including grouping (), field reference $, logical !, &&, ||, arithmetic +, -, string concatenation, and comparison ==, !=, <, <=, >, >=.
It also supports substring matching ~ and !~ (e.g., $1 ~ /foo/), though it does not implement full regular expression matching (it performs a case-sensitive substring search).
Built-in functions:
substr(s, m[, n]): Substring starting at position m with length n.tolower(s) / toupper(s): Case conversion.match(s, pat): Returns the 1-based position of pat in s.length([s]): Returns string length.
# Examples of pattern usage
./test -p foo # Matches any test with 'foo' in the name
./test -p '$2 == "Two"' # Selects subgroup 'Two'
./test -p '! /skip/' # Excludes tests containing 'skip'