aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/libstore-support
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/libstore-support')
-rw-r--r--tests/unit/libstore-support/tests/test-data.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unit/libstore-support/tests/test-data.hh b/tests/unit/libstore-support/tests/test-data.hh
new file mode 100644
index 000000000..7aa1dd90d
--- /dev/null
+++ b/tests/unit/libstore-support/tests/test-data.hh
@@ -0,0 +1,25 @@
+#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);
+}
+
+}