mirror of
https://github.com/NixOS/nix
synced 2025-06-28 09:31:16 +02:00
C API: nix_get_string now accepts a callback to return the value
This commit is contained in:
parent
74e4bc9b1d
commit
c75b143b6c
6 changed files with 65 additions and 35 deletions
|
@ -6,7 +6,9 @@
|
|||
#include "nix_api_expr_internal.h"
|
||||
#include "nix_api_value.h"
|
||||
#include "nix_api_external.h"
|
||||
|
||||
#include "tests/nix_api_expr.hh"
|
||||
#include "tests/string_callback.hh"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
@ -58,6 +60,9 @@ TEST_F(nix_api_expr_test, nix_expr_eval_external)
|
|||
|
||||
nix_value_call(ctx, state, valueFn, value, valueResult);
|
||||
|
||||
ASSERT_STREQ("nix-external<MyExternalValueDesc( 42 )>", nix_get_string(nullptr, valueResult));
|
||||
std::string string_value;
|
||||
nix_get_string(nullptr, valueResult, OBSERVE_STRING(string_value));
|
||||
ASSERT_STREQ("nix-external<MyExternalValueDesc( 42 )>", string_value.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue