requireTool

fnvoid requireTool(string toolName, string message = null)

Skip a test if an external tool is not available.

This function checks if the specified tool exists in PATH and throws an exception to skip the test if it's not available. This is useful for tests that depend on external tools.

Note

a thrown exception fails a D unittest rather than skipping it.

For a clean skip, structure the unittest to return early instead:

unittest
{
   if (!hasExternalTool("readelf"))
      return; // tool unavailable on this host - skip
   // Test code here...
}

Parameters

toolNameThe name of the tool to check.
messageOptional message explaining why the tool is needed.

Throws

Exception if the tool is not available.