Approving Objects¶
Note
All classes and symbols listed here are in the ApprovalTests
namespace.
Approvals¶
-
using ApprovalTests::Approvals = TApprovals<ToStringCompileTimeOptions<StringMaker>>¶
TApprovals¶
-
template<typename TCompileTimeOptions>
class TApprovals¶ Verifying single objects
See Testing Single Objects in the User Guide on GitHub.
-
template<typename T, typename = IsNotDerivedFromWriter<T>>
static inline void verify(const T &contents, const Options &options = Options())¶
-
template<typename T, typename Function, typename = Detail::EnableIfNotOptionsOrReporter<Function>>
static inline void verify(const T &contents, Function converter, const Options &options = Options())¶
-
static inline void verify(const ApprovalWriter &writer, const Options &options = Options())¶
Note that this overload ignores any scrubber in options.
Verifying containers of objects - supplying an iterator range
See Testing Containers in the User Guide on GitHub.
Verifying containers of objects - supplying a container
See Testing Containers in the User Guide on GitHub.
-
template<typename Container>
static inline void verifyAll(const std::string &header, const Container &list, std::function<void(typename Container::value_type, std::ostream&)> converter, const Options &options = Options())¶
Verifying containers of objects - supplying an initializer list
See Testing Containers in the User Guide on GitHub.
-
template<typename T>
static inline void verifyAll(const std::string &header, const std::initializer_list<T> &list, std::function<void(typename std::initializer_list<T>::value_type, std::ostream&)> converter, const Options &options = Options())¶
Other verify methods
-
static inline void verifyExceptionMessage(const std::function<void(void)> &functionThatThrows, const Options &options = Options())¶
Verify the text of an exception.
See Testing exception messages in the User Guide on GitHub.
Customising Approval Tests
These static methods customise various aspects of Approval Tests behaviour.
-
static inline SubdirectoryDisposer useApprovalsSubdirectory(const std::string &subdirectory = "approval_tests")¶
See Using sub-directories for approved files in the User Guide on GitHub.
See Registering a default reporter in the User Guide on GitHub.
See Front Loaded Reporters in the User Guide on GitHub.
-
static inline DefaultNamerDisposer useAsDefaultNamer(NamerCreator namerCreator)¶
See Registering a Custom Namer in the User Guide on GitHub.
-
static inline FileNameSanitizerDisposer useFileNameSanitizer(FileNameSanitizer sanitizer)¶
See Converting Test Names to Valid FileNames in the User Guide on GitHub.
Public Types
-
using IsNotDerivedFromWriter = typename std::enable_if<!std::is_base_of<ApprovalWriter, T>::value, int>::type¶
Public Static Functions
-
static inline std::shared_ptr<ApprovalNamer> getDefaultNamer()¶
-
template<typename T, typename = IsNotDerivedFromWriter<T>>
CombinationApprovals¶
-
using ApprovalTests::CombinationApprovals = TCombinationApprovals<ToStringCompileTimeOptions<APPROVAL_TESTS_DEFAULT_STREAM_CONVERTER>>¶
TCombinationApprovals¶
-
template<typename TCompileTimeOptions>
class TCombinationApprovals¶ Verifying combinations of objects
See Testing combinations in the User Guide on GitHub.
-
template<class Converter, class Container, class ...Containers>
static inline void verifyAllCombinations(const Options &options, const std::string &header, Converter &&converter, const Container &input0, const Containers&... inputs)¶
-
template<class Converter, class ...Containers>
static inline ApprovalTests::Detail::EnableIfNotOptionsOrReporterOrString<Converter> verifyAllCombinations(const std::string &header, Converter &&converter, const Containers&... inputs)¶
-
template<class Converter, class ...Containers>
static inline ApprovalTests::Detail::EnableIfNotOptionsOrReporterOrString<Converter> verifyAllCombinations(const Options &options, Converter &&converter, const Containers&... inputs)¶
-
template<class Converter, class ...Containers>
static inline ApprovalTests::Detail::EnableIfNotOptionsOrReporterOrString<Converter> verifyAllCombinations(Converter &&converter, const Containers&... inputs)¶
-
template<class Converter, class Container, class ...Containers>