proxygen
folly::test::detail::CheckResult Class Reference

#include <TestUtils.h>

Public Member Functions

 CheckResult (bool s) noexcept
 
 operator bool () const noexcept
 
const char * what () const noexcept
 
template<typename T >
CheckResultoperator<< (T &&t)
 

Private Attributes

bool success_
 
std::string message_
 

Detailed Description

Helper class for implementing test macros

Definition at line 147 of file TestUtils.h.

Constructor & Destructor Documentation

folly::test::detail::CheckResult::CheckResult ( bool  s)
inlineexplicitnoexcept

Definition at line 149 of file TestUtils.h.

Referenced by folly::test::detail::checkThrowErrno(), and folly::test::detail::checkThrowRegex().

149 : success_(s) {}
static set< string > s

Member Function Documentation

folly::test::detail::CheckResult::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 151 of file TestUtils.h.

References success_.

151  {
152  return success_;
153  }
template<typename T >
CheckResult& folly::test::detail::CheckResult::operator<< ( T &&  t)
inline

Support the << operator for building up the error message.

The arguments are treated as with folly::to<string>(), and we do not support iomanip parameters. The main reason we use the << operator as opposed to a variadic function like folly::to is that clang-format formats long statements using << much nicer than function call arguments.

Definition at line 167 of file TestUtils.h.

References message_, folly::pushmi::detail::t, and folly::toAppend().

167  {
168  toAppend(std::forward<T>(t), &message_);
169  return *this;
170  }
void toAppend(char value, Tgt *result)
Definition: Conv.h:406
const char* folly::test::detail::CheckResult::what ( ) const
inlinenoexcept

Definition at line 154 of file TestUtils.h.

References message_.

154  {
155  return message_.c_str();
156  }

Member Data Documentation

std::string folly::test::detail::CheckResult::message_
private

Definition at line 174 of file TestUtils.h.

Referenced by operator<<(), and what().

bool folly::test::detail::CheckResult::success_
private

Definition at line 173 of file TestUtils.h.

Referenced by operator bool().


The documentation for this class was generated from the following file: