This option type integrates with Tasty's option system to control whether
tests should be skipped. When set to SkipTest True, tests will show as
[SKIPPED] in yellow in the test output and won't actually execute.
Used internally by the skip function and Flavored type to implement
test skipping functionality.
A general-purpose wrapper for transforming TestTrees generated by tasty_ functions.
The Flavored type allows you to apply transformations to test trees before they
are added to the test suite. This enables applying various options and modifications
such as skipping tests, setting timeouts, adding metadata, grouping, etc.
Example usage:
-- Skip a test
tasty_skipThis :: Flavored Property
tasty_skipThis = flavored skip $ property $ do
-- This test will be skipped
H.failure
Mark a test tree to be skipped by setting the SkipTest option to True.
Usage guidelines: see the Guidelines for using skip and platform section (skipPlatform).
In short, for tasty_ tests prefer flavoredskip to let the outer Tasty instance
short-circuit at the TestTree level. Direct skip on a pre-built tree applies the option
to the subtree; the test can still observe SkipTest via askOption.
Examples:
@
-- Direct usage on a TestTree (the test can read SkipTest via askOption)
test_directSkip :: TestTree
test_directSkip = skip $ testCase "will be skipped" $ pure ()
- Preferred for tasty_ tests: apply at the right stage using Flavored
tasty_skipProperty :: Flavored Property
tasty_skipProperty = flavored skip $ property $ do
Conditionally run a test based on a platform expression.
Usage guidelines, syntax, and examples: see the Guidelines for using skip and platform
section (skipPlatform).
The expression supports logical operations with platform names:
- Platform names: "linux", "darwin", "mingw32", "windows", "unix"
- Negation: "!platform" (not on platform)
- Conjunction: "platform1 & platform2" (on both platforms)
- Disjunction: "platform1 | platform2" (on either platform)
- Parentheses: "(platform1 | platform2) & !platform3"
Examples:
@
-- Only on Linux
test_linuxOnly :: TestTree
test_linuxOnly = platform "linux" $ testCase "Linux only" $ pure ()
- Not on Windows or macOS
test_notWinMac :: TestTree
test_notWinMac = platform "!windows & !darwin" $ testCase "Unix-like only" $ pure ()
- On Linux or macOS but not Windows
test_unixLike :: TestTree
test_unixLike = platform "(linux | darwin) & !windows" $ testCase "Unix-like" $ pure ()
@
Evaluate a platform expression against a given platform string.
Inputs:
- The first argument is the platform expression (e.g. "linux | darwin", "!windows").
- The second argument is the current platform, typically System.Info.os (e.g. "linux", "darwin", "mingw32").
Semantics (result is True when the test should run):
- Supported platform names: "linux", "darwin", "mingw32", "windows" (alias for "mingw32"), and "unix" (alias for "linux | darwin").
- Supported operators: NOT !, AND &, OR |.
- Unknown simple names evaluate to False (do not run).
- Malformed or empty expressions evaluate to True (default to running).
Malformed includes the presence of operator characters without a valid parse.
- Parentheses characters ( and ) are tokenized but grouping is not currently implemented;
using parentheses in the expression will cause it to be treated as malformed and therefore
default to True (run). Prefer composing with & and | without parentheses.