summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-26 17:36:36 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-26 17:36:36 +0100
commit88850fadb5d5c3bce5ca2959b81cca1cd067c8ca (patch)
tree882ee35f0268175141be185f2655f27571abe788 /test
parentGet the target schema name (diff)
downloadmygrate-88850fadb5d5c3bce5ca2959b81cca1cd067c8ca.tar.bz2
mygrate-88850fadb5d5c3bce5ca2959b81cca1cd067c8ca.tar.xz
mygrate-88850fadb5d5c3bce5ca2959b81cca1cd067c8ca.zip
General purpose optional stream<<
Diffstat (limited to 'test')
-rw-r--r--test/helpers.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/helpers.h b/test/helpers.h
index 107eda5..59ae18d 100644
--- a/test/helpers.h
+++ b/test/helpers.h
@@ -4,6 +4,8 @@
#include <concepts>
#include <cstddef>
#include <ctime>
+#include <iostream>
+#include <optional>
inline constexpr std::byte operator""_b(const unsigned long long hex)
{
@@ -24,6 +26,18 @@ namespace std {
{
return to_integer<T>(b) != i;
}
+
+ template<typename T>
+ ostream &
+ operator<<(ostream & s, const std::optional<T> & o)
+ {
+ if (o) {
+ return s << *o;
+ }
+ else {
+ return s << "-";
+ }
+ }
}
inline struct tm