forked from approvals/ApprovalTests.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApprovalTestTests.cpp
More file actions
31 lines (26 loc) · 820 Bytes
/
Copy pathApprovalTestTests.cpp
File metadata and controls
31 lines (26 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "doctest.h"
#include "ApprovalTests/Approvals.h"
#include "ApprovalTests/writers/StringWriter.h"
using namespace ApprovalTests;
TEST_CASE("YouCanUseAWriter")
{
using HtmlWriter = StringWriter;
// begin-snippet: use_custom_writer
HtmlWriter writer("<h1>hello world</h1>", ".html");
Approvals::verify(writer);
// end-snippet
}
TEST_CASE("YouCanSpecifyYourFileExtension")
{
// begin-snippet: use_custom_file_extension
Approvals::verifyWithExtension("<h1>hello world</h1>", ".html");
// end-snippet
}
TEST_CASE("YouCanSpecifyYourFileExtensionWithToString")
{
Approvals::verifyWithExtension(1337, ".csv");
}
TEST_CASE("YouCanSpecifyYourFileExtensionWithFormatter")
{
Approvals::verifyWithExtension(1337, [](auto value, auto& os){os << "**value:** " << value;}, ".md");
}