mirror of
https://github.com/znc/znc.git
synced 2026-08-12 03:42:48 +02:00
Fix test after fixing #1190
This commit is contained in:
+12
-2
@@ -117,21 +117,23 @@ public:
|
||||
#ifndef SWIG
|
||||
template <typename M>
|
||||
M& As() ZNC_LVREFQUAL {
|
||||
static_assert(std::is_base_of<CMessage, M>{}, "Must be subclass of CMessage");
|
||||
static_assert(sizeof(M) == sizeof(CMessage), "No data members allowed in CMessage subclasses.");
|
||||
return static_cast<M&>(*this);
|
||||
}
|
||||
|
||||
template <typename M>
|
||||
const M& As() const ZNC_LVREFQUAL {
|
||||
static_assert(std::is_base_of<CMessage, M>{}, "Must be subclass of CMessage");
|
||||
static_assert(sizeof(M) == sizeof(CMessage), "No data members allowed in CMessage subclasses.");
|
||||
return static_cast<const M&>(*this);
|
||||
}
|
||||
|
||||
template <typename M>
|
||||
template <typename M, typename = typename std::enable_if<std::is_base_of<CMessage, M>{}>::type>
|
||||
operator M&() ZNC_LVREFQUAL {
|
||||
return As<M>();
|
||||
}
|
||||
template <typename M>
|
||||
template <typename M, typename = typename std::enable_if<std::is_base_of<CMessage, M>{}>::type>
|
||||
operator const M&() const ZNC_LVREFQUAL {
|
||||
return As<M>();
|
||||
}
|
||||
@@ -158,6 +160,14 @@ private:
|
||||
bool m_bColon = false;
|
||||
};
|
||||
|
||||
// For gtest
|
||||
#ifdef GTEST_FAIL
|
||||
template <typename M, typename = typename std::enable_if<std::is_base_of<CMessage, M>{}>::type>
|
||||
inline ::std::ostream& operator<<(::std::ostream& os, const M& msg) {
|
||||
return os << msg.ToString().Escape_n(CString::EDEBUG);
|
||||
}
|
||||
#endif
|
||||
|
||||
// The various CMessage subclasses are "mutable views" to the data held by CMessage.
|
||||
// They provide convenient access to message type speficic attributes, but are not
|
||||
// allowed to hold extra data of their own.
|
||||
|
||||
Reference in New Issue
Block a user