mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpiutil] Refactor SpanMatcher and TestPrinters from ntcore (#5658)
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user