From b9cd24a4a85beafe44b2d059c61e0daa2c842e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Lafuente?= Date: Thu, 22 Feb 2024 12:57:51 +0100 Subject: [PATCH] C API: fix api_expr tests --- tests/unit/libexpr/nix_api_expr.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/unit/libexpr/nix_api_expr.cc b/tests/unit/libexpr/nix_api_expr.cc index 0389306ec..ec51d14a3 100644 --- a/tests/unit/libexpr/nix_api_expr.cc +++ b/tests/unit/libexpr/nix_api_expr.cc @@ -85,14 +85,20 @@ TEST_F(nix_api_expr_test, nix_build_drv) Value * drvPathValue = nix_get_attr_byname(nullptr, value, state, "drvPath"); 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); ASSERT_EQ(true, nix_store_is_valid_path(nullptr, store, drvStorePath)); Value * outPathValue = nix_get_attr_byname(nullptr, value, state, "outPath"); 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); ASSERT_EQ(false, nix_store_is_valid_path(nullptr, store, outStorePath));