Variable

GLib-2.0GLibTEST_OPTION_ISOLATE_DIRSConstSince 2.60

TEST_OPTION_ISOLATE_DIRS: string

A value that can be passed as an option to GLib.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 GLib.test_run is called, so calls to (for example) GLib.get_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 GLib.get_user_cache_dir, the caller must be prepared to create the directory if it doesn’t exist.

2.60