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

Improve tests for OutputsSpec

This commit is contained in:
John Ericson 2023-01-11 17:31:32 -05:00
parent 5ba6e5d0d9
commit 0faf5326bd
3 changed files with 97 additions and 56 deletions

View file

@ -25,9 +25,7 @@ struct OutputNames : std::set<std::string> {
OutputNames() = delete;
};
struct AllOutputs {
bool operator < (const AllOutputs & _) const { return false; }
};
struct AllOutputs : std::monostate { };
typedef std::variant<AllOutputs, OutputNames> _OutputsSpecRaw;
@ -64,9 +62,7 @@ struct OutputsSpec : _OutputsSpecRaw {
std::string to_string() const;
};
struct DefaultOutputs {
bool operator < (const DefaultOutputs & _) const { return false; }
};
struct DefaultOutputs : std::monostate { };
typedef std::variant<DefaultOutputs, OutputsSpec> _ExtendedOutputsSpecRaw;
@ -84,6 +80,7 @@ struct ExtendedOutputsSpec : _ExtendedOutputsSpecRaw {
/* Parse a string of the form 'prefix^output1,...outputN' or
'prefix^*', returning the prefix and the extended outputs spec. */
static std::pair<std::string_view, ExtendedOutputsSpec> parse(std::string_view s);
static std::optional<std::pair<std::string_view, ExtendedOutputsSpec>> parseOpt(std::string_view s);
std::string to_string() const;
};