glib

Static TEST_OPTION_ISOLATE_DIRS

Source
pub static TEST_OPTION_ISOLATE_DIRS: &GStr
Available on crate feature v2_60 only.
Expand description

A value that can be passed as an option to test_init().

Creates a unique temporary directory for each unit test and uses sets XDG directories to point into subdirectories of it for the duration of the unit test. The directory tree is cleaned up after the test finishes successfully.

Note that this doesn’t take effect until test_run() is called, so calls to (for example) home_dir() will return the system-wide value when made in a test program’s main() function.

The following functions will return subdirectories of the temporary directory when this option is used. The specific subdirectory paths in use are not guaranteed to be stable API — always use a getter function to retrieve them.

The subdirectories may not be created by the test harness; as with normal calls to functions like user_cache_dir(), the caller must be prepared to create the directory if it doesn’t exist.