mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 17:16:15 +02:00
C API: fix api_expr tests
This commit is contained in:
parent
24c8f6864d
commit
b9cd24a4a8
1 changed files with 8 additions and 2 deletions
|
@ -85,14 +85,20 @@ TEST_F(nix_api_expr_test, nix_build_drv)
|
||||||
|
|
||||||
Value * drvPathValue = nix_get_attr_byname(nullptr, value, state, "drvPath");
|
Value * drvPathValue = nix_get_attr_byname(nullptr, value, state, "drvPath");
|
||||||
const char * drvPath = nix_get_string(nullptr, drvPathValue);
|
const char * drvPath = nix_get_string(nullptr, drvPathValue);
|
||||||
ASSERT_STREQ("/nix/store/5fxx84dpz59ch79wf9x8ja715p7hf3q1-myname.drv", drvPath);
|
|
||||||
|
std::string p = drvPath;
|
||||||
|
std::string pEnd = "-myname.drv";
|
||||||
|
ASSERT_EQ(pEnd, p.substr(p.size() - pEnd.size()));
|
||||||
|
|
||||||
StorePath * drvStorePath = nix_store_parse_path(ctx, store, drvPath);
|
StorePath * drvStorePath = nix_store_parse_path(ctx, store, drvPath);
|
||||||
ASSERT_EQ(true, nix_store_is_valid_path(nullptr, store, drvStorePath));
|
ASSERT_EQ(true, nix_store_is_valid_path(nullptr, store, drvStorePath));
|
||||||
|
|
||||||
Value * outPathValue = nix_get_attr_byname(nullptr, value, state, "outPath");
|
Value * outPathValue = nix_get_attr_byname(nullptr, value, state, "outPath");
|
||||||
const char * outPath = nix_get_string(nullptr, outPathValue);
|
const char * outPath = nix_get_string(nullptr, outPathValue);
|
||||||
ASSERT_STREQ("/nix/store/rp0xk0641l8hpdb84fsx3kwwrl45pxan-myname", outPath);
|
|
||||||
|
p = outPath;
|
||||||
|
pEnd = "-myname";
|
||||||
|
ASSERT_EQ(pEnd, p.substr(p.size() - pEnd.size()));
|
||||||
|
|
||||||
StorePath * outStorePath = nix_store_parse_path(ctx, store, outPath);
|
StorePath * outStorePath = nix_store_parse_path(ctx, store, outPath);
|
||||||
ASSERT_EQ(false, nix_store_is_valid_path(nullptr, store, outStorePath));
|
ASSERT_EQ(false, nix_store_is_valid_path(nullptr, store, outStorePath));
|
||||||
|
|
Loading…
Reference in a new issue