mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
C API: refactor test support
This commit is contained in:
parent
693e8ec8fe
commit
2e1dbbe307
6 changed files with 55 additions and 74 deletions
|
@ -6,9 +6,8 @@
|
|||
#include "nix_api_expr_internal.h"
|
||||
#include "nix_api_value.h"
|
||||
#include "nix_api_external.h"
|
||||
#include "tests/nix_api_store.hh"
|
||||
#include "tests/nix_api_expr.hh"
|
||||
|
||||
#include <string>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace nixC {
|
||||
|
@ -42,25 +41,7 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
class nix_api_external_test : public nix_api_store_test
|
||||
{
|
||||
public:
|
||||
nix_api_external_test()
|
||||
{
|
||||
state = nix_state_create(nullptr, nullptr, store);
|
||||
value = nix_alloc_value(nullptr, state);
|
||||
}
|
||||
~nix_api_external_test()
|
||||
{
|
||||
nix_gc_decref(nullptr, value);
|
||||
nix_state_free(state);
|
||||
}
|
||||
|
||||
EvalState * state;
|
||||
Value * value;
|
||||
};
|
||||
|
||||
TEST_F(nix_api_external_test, nix_expr_eval_from_string)
|
||||
TEST_F(nix_api_expr_test, nix_expr_eval_external)
|
||||
{
|
||||
MyExternalValueDesc * external = new MyExternalValueDesc(42);
|
||||
ExternalValue * val = nix_create_external_value(ctx, external, external);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue