diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-01-29 12:37:32 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-01-29 13:52:57 -0500 |
commit | ec0c0efec6d7eed868b424434748b97651e02bcc (patch) | |
tree | 29ced9d126d9db8eced4e0ab380a990dbda51885 /src/libstore | |
parent | 6772e9ed0ac7853cefdeb6b354c81cba531829f2 (diff) |
Allow unit test infra to be reused across libs' tests
This allows using Arbitrary "instances" defined in libstore-tests in
libexpr-tests, something we will leverage in a moment.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/tests/libstore.hh (renamed from src/libstore/tests/libstoretests.hh) | 0 | ||||
-rw-r--r-- | src/libstore/tests/local.mk | 18 | ||||
-rw-r--r-- | src/libstore/tests/path.cc | 8 | ||||
-rw-r--r-- | src/libstore/tests/path.hh | 15 |
4 files changed, 33 insertions, 8 deletions
diff --git a/src/libstore/tests/libstoretests.hh b/src/libstore/tests/libstore.hh index 05397659b..05397659b 100644 --- a/src/libstore/tests/libstoretests.hh +++ b/src/libstore/tests/libstore.hh diff --git a/src/libstore/tests/local.mk b/src/libstore/tests/local.mk index a2cf8a0cf..c24712ccf 100644 --- a/src/libstore/tests/local.mk +++ b/src/libstore/tests/local.mk @@ -1,6 +1,20 @@ -check: libstore-tests_RUN +check: libstore-tests-exe_RUN -programs += libstore-tests +programs += libstore-tests-exe + +libstore-tests-exe_NAME = libnixstore-tests + +libstore-tests-exe_DIR := $(d) + +libstore-tests-exe_INSTALL_DIR := + +libstore-tests-exe_LIBS = libstore-tests + +libstore-tests-exe_LDFLAGS := $(GTEST_LIBS) + +libraries += libstore-tests + +libstore-tests_NAME = libnixstore-tests libstore-tests_DIR := $(d) diff --git a/src/libstore/tests/path.cc b/src/libstore/tests/path.cc index 8ea252c92..2fc6d7e48 100644 --- a/src/libstore/tests/path.cc +++ b/src/libstore/tests/path.cc @@ -7,7 +7,8 @@ #include "path-regex.hh" #include "store-api.hh" -#include "libstoretests.hh" +#include "tests/libstore.hh" +#include "tests/path.hh" namespace nix { @@ -73,11 +74,6 @@ void showValue(const StorePath & p, std::ostream & os) { namespace rc { using namespace nix; -template<> -struct Arbitrary<StorePath> { - static Gen<StorePath> arbitrary(); -}; - Gen<StorePath> Arbitrary<StorePath>::arbitrary() { auto len = *gen::inRange<size_t>(1, StorePath::MaxPathLen); diff --git a/src/libstore/tests/path.hh b/src/libstore/tests/path.hh new file mode 100644 index 000000000..0ac9bb9f2 --- /dev/null +++ b/src/libstore/tests/path.hh @@ -0,0 +1,15 @@ +#pragma once + +#include <rapidcheck.h> + +#include "path.hh" + +namespace rc { +using namespace nix; + +template<> +struct Arbitrary<StorePath> { + static Gen<StorePath> arbitrary(); +}; + +} |