1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-01 14:41:00 +01:00

Make nix path-info --json return an object not array

Before it returned a list of JSON objects with store object information,
including the path in each object. Now, it maps the paths to JSON
objects with the metadata sans path.

This matches how `nix derivation show` works.

Quite hillariously, none of our existing functional tests caught this
change to `path-info --json` though they did use it. So just new
functional tests need to be added.
This commit is contained in:
John Ericson 2023-10-22 21:12:54 -04:00
parent a7212e169b
commit cc46ea1630
14 changed files with 108 additions and 54 deletions

View file

@ -19,8 +19,8 @@ class PathInfoTest : public CharacterizationTest, public LibStoreTest
}
};
static ValidPathInfo makePathInfo(const Store & store, bool includeImpureInfo) {
ValidPathInfo info {
static UnkeyedValidPathInfo makePathInfo(const Store & store, bool includeImpureInfo) {
UnkeyedValidPathInfo info = ValidPathInfo {
store,
"foo",
FixedOutputInfo {
@ -54,7 +54,7 @@ static ValidPathInfo makePathInfo(const Store & store, bool includeImpureInfo) {
TEST_F(PathInfoTest, PathInfo_ ## STEM ## _from_json) { \
readTest(#STEM, [&](const auto & encoded_) { \
auto encoded = json::parse(encoded_); \
ValidPathInfo got = ValidPathInfo::fromJSON( \
UnkeyedValidPathInfo got = UnkeyedValidPathInfo::fromJSON( \
*store, \
encoded); \
auto expected = makePathInfo(*store, PURE); \