aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/derived-path.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-29 13:52:38 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-29 17:09:59 -0500
commitecd3e4ebd777dca694d0c60431641f054ec2d1ce (patch)
treee11a073f6cf5baa207a9da8bf2f8e2bb200c3ab9 /src/libstore/derived-path.hh
parentec0c0efec6d7eed868b424434748b97651e02bcc (diff)
More property tests
Also put proper comparison methods on `DerivedPath` and `NixStringContextElem`, which is needed for the tests but good in general.
Diffstat (limited to 'src/libstore/derived-path.hh')
-rw-r--r--src/libstore/derived-path.hh11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libstore/derived-path.hh b/src/libstore/derived-path.hh
index 4edff7467..9e0cce377 100644
--- a/src/libstore/derived-path.hh
+++ b/src/libstore/derived-path.hh
@@ -4,8 +4,9 @@
#include "path.hh"
#include "realisation.hh"
#include "outputs-spec.hh"
+#include "comparator.hh"
-#include <optional>
+#include <variant>
#include <nlohmann/json_fwd.hpp>
@@ -27,8 +28,7 @@ struct DerivedPathOpaque {
std::string to_string(const Store & store) const;
static DerivedPathOpaque parse(const Store & store, std::string_view);
- bool operator < (const DerivedPathOpaque & b) const
- { return path < b.path; }
+ GENERATE_CMP(DerivedPathOpaque, me->path);
};
/**
@@ -51,8 +51,7 @@ struct DerivedPathBuilt {
static DerivedPathBuilt parse(const Store & store, std::string_view, std::string_view);
nlohmann::json toJSON(ref<Store> store) const;
- bool operator < (const DerivedPathBuilt & b) const
- { return std::make_pair(drvPath, outputs) < std::make_pair(b.drvPath, b.outputs); }
+ GENERATE_CMP(DerivedPathBuilt, me->drvPath, me->outputs);
};
using _DerivedPathRaw = std::variant<
@@ -96,6 +95,8 @@ struct BuiltPathBuilt {
nlohmann::json toJSON(ref<Store> store) const;
static BuiltPathBuilt parse(const Store & store, std::string_view);
+
+ GENERATE_CMP(BuiltPathBuilt, me->drvPath, me->outputs);
};
using _BuiltPathRaw = std::variant<