lix/tests/unit/libstore-support/tests/test-data.hh
Rebecca Turner 12f2565f91 Don't run libstore unit tests in project root
This keeps the libstore unit tests from writing
`libstore-unit-tests.xml` to the project root.

Change-Id: I0d9909aabf9f3574cc1e72a5ae81daefba9a394b
2024-04-08 12:43:35 -07:00

26 lines
533 B
C++

#pragma once
#include "util.hh"
#include "types.hh"
namespace nix {
// TODO: These helpers should be available in all unit tests.
/**
* The path to the unit test data directory. See the contributing guide
* in the manual for further details.
*/
static Path getUnitTestData() {
return getEnv("_NIX_TEST_UNIT_DATA").value();
}
/**
* Resolve a path under the unit test data directory to an absolute path.
*/
static Path getUnitTestDataPath(std::string_view path) {
return absPath(getUnitTestData() + "/" + path);
}
}