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

Test store paths, with property tests

The property test in fact found a bug: we were excluding numbers!

(cherry picked from commit 018e2571aa)
This commit is contained in:
John Ericson 2023-01-19 00:26:06 -05:00 committed by github-actions[bot]
parent 01b30df520
commit d111d2ed49
8 changed files with 228 additions and 8 deletions

View file

@ -0,0 +1,30 @@
#pragma once
#include <string_view>
namespace nix::regex {
// TODO use constexpr string building like
// https://github.com/akrzemi1/static_string/blob/master/include/ak_toolkit/static_string.hpp
static inline std::string either(std::string_view a, std::string_view b)
{
return std::string { a } + "|" + b;
}
static inline std::string group(std::string_view a)
{
return std::string { "(" } + a + ")";
}
static inline std::string many(std::string_view a)
{
return std::string { "(?:" } + a + ")*";
}
static inline std::string list(std::string_view a)
{
return std::string { a } + many(group("," + a));
}
}