1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 14:21:48 +02:00

dropEmptyInitThenConcatStringsSep -> concatStringSep: shortRefs are not empty

This commit is contained in:
Robert Hensing 2024-07-13 00:50:39 +02:00
parent 608a425550
commit d3e49ac881
4 changed files with 20 additions and 4 deletions

View file

@ -26,9 +26,9 @@ static UnkeyedValidPathInfo makeEmpty()
};
}
static UnkeyedValidPathInfo makeFull(const Store & store, bool includeImpureInfo)
static ValidPathInfo makeFullKeyed(const Store & store, bool includeImpureInfo)
{
UnkeyedValidPathInfo info = ValidPathInfo {
ValidPathInfo info = ValidPathInfo {
store,
"foo",
FixedOutputInfo {
@ -57,6 +57,9 @@ static UnkeyedValidPathInfo makeFull(const Store & store, bool includeImpureInfo
}
return info;
}
static UnkeyedValidPathInfo makeFull(const Store & store, bool includeImpureInfo) {
return makeFullKeyed(store, includeImpureInfo);
}
#define JSON_TEST(STEM, OBJ, PURE) \
TEST_F(PathInfoTest, PathInfo_ ## STEM ## _from_json) { \
@ -86,4 +89,13 @@ JSON_TEST(empty_impure, makeEmpty(), true)
JSON_TEST(pure, makeFull(*store, false), false)
JSON_TEST(impure, makeFull(*store, true), true)
TEST_F(PathInfoTest, PathInfo_full_shortRefs) {
ValidPathInfo it = makeFullKeyed(*store, true);
// it.references = unkeyed.references;
auto refs = it.shortRefs();
ASSERT_EQ(refs.size(), 2);
ASSERT_EQ(*refs.begin(), "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar");
ASSERT_EQ(*++refs.begin(), "n5wkd9frr45pa74if5gpz9j7mifg27fh-foo");
}
} // namespace nix