[wpiutil] Refactor SpanMatcher and TestPrinters from ntcore (#5658)

This commit is contained in:
Peter Johnson
2023-09-18 00:11:36 -07:00
committed by GitHub
parent 9fe258427a
commit 7be290147c
14 changed files with 86 additions and 45 deletions

View File

@@ -10,33 +10,7 @@
#include <string_view>
#include <gtest/gtest.h>
namespace wpi {
class json;
inline void PrintTo(std::string_view str, ::std::ostream* os) {
::testing::internal::PrintStringTo(std::string{str}, os);
}
template <typename T>
void PrintTo(std::span<T> val, ::std::ostream* os) {
*os << '{';
bool first = true;
for (auto v : val) {
if (first) {
first = false;
} else {
*os << ", ";
}
*os << ::testing::PrintToString(v);
}
*os << '}';
}
void PrintTo(const json& val, ::std::ostream* os);
} // namespace wpi
#include <wpi/TestPrinters.h>
namespace nt {