1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 15:51:15 +02:00

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.
This commit is contained in:
John Ericson 2023-01-29 12:37:32 -05:00
parent 6772e9ed0a
commit ec0c0efec6
13 changed files with 50 additions and 21 deletions

View file

@ -1,7 +1,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "libexprtests.hh"
#include "tests/libexpr.hh"
namespace nix {

View file

@ -1,4 +1,4 @@
#include "libexprtests.hh"
#include "tests/libexpr.hh"
#include "value-to-json.hh"
namespace nix {

View file

@ -7,18 +7,19 @@
#include "eval-inline.hh"
#include "store-api.hh"
#include "tests/libstore.hh"
namespace nix {
class LibExprTest : public ::testing::Test {
class LibExprTest : public LibStoreTest {
public:
static void SetUpTestSuite() {
initLibStore();
LibStoreTest::SetUpTestSuite();
initGC();
}
protected:
LibExprTest()
: store(openStore("dummy://"))
: LibStoreTest()
, state({}, store)
{
}
@ -36,7 +37,6 @@ namespace nix {
return state.symbols.create(value);
}
ref<Store> store;
EvalState state;
};

View file

@ -2,6 +2,8 @@ check: libexpr-tests_RUN
programs += libexpr-tests
libexpr-tests_NAME := libnixexpr-tests
libexpr-tests_DIR := $(d)
libexpr-tests_INSTALL_DIR :=
@ -12,6 +14,6 @@ libexpr-tests_SOURCES := \
libexpr-tests_CXXFLAGS += -I src/libexpr -I src/libutil -I src/libstore -I src/libexpr/tests
libexpr-tests_LIBS = libexpr libutil libstore libfetchers
libexpr-tests_LIBS = libstore-tests libexpr libutil libstore libfetchers
libexpr-tests_LDFLAGS := $(GTEST_LIBS) -lgmock

View file

@ -1,7 +1,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "libexprtests.hh"
#include "tests/libexpr.hh"
namespace nix {
class CaptureLogger : public Logger

View file

@ -1,4 +1,4 @@
#include "libexprtests.hh"
#include "tests/libexpr.hh"
namespace nix {
// Testing of trivial expressions

View file

@ -1,6 +1,6 @@
#include "value/context.hh"
#include "libexprtests.hh"
#include "tests/libexpr.hh"
namespace nix {