libexpr: abstract string members in Value

to allow multiple internal reps similar to how lists works

Change-Id: I94139aab28b04b73b055a3dc05d496758ee72538
This commit is contained in:
Mel Zuser
2024-05-15 20:03:19 -07:00
parent 9249c89dc6
commit 1eff2adc93
16 changed files with 72 additions and 48 deletions
+2 -2
View File
@@ -713,14 +713,14 @@ namespace nix {
// FIXME: add a test that verifies the string context is as expected
auto v = eval("builtins.replaceStrings [\"oo\" \"a\"] [\"a\" \"i\"] \"foobar\"");
ASSERT_EQ(v.type(), nString);
ASSERT_EQ(v.string.s, std::string_view("fabir"));
ASSERT_EQ(v.c_str(), std::string_view("fabir"));
}
TEST_F(PrimOpTest, concatStringsSep) {
// FIXME: add a test that verifies the string context is as expected
auto v = eval("builtins.concatStringsSep \"%\" [\"foo\" \"bar\" \"baz\"]");
ASSERT_EQ(v.type(), nString);
ASSERT_EQ(std::string_view(v.string.s), "foo%bar%baz");
ASSERT_EQ(std::string_view(v.c_str()), "foo%bar%baz");
}
TEST_F(PrimOpTest, split1) {