Skip to content

Commit f0baedb

Browse files
claremacraeisidore
andcommitted
F Update to ApprovalTests v10.12.0
Co-Authored-By: Llewellyn Falco <llewellyn.falco@gmail.com>
1 parent 09b3857 commit f0baedb

File tree

2 files changed

+70
-6
lines changed

2 files changed

+70
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#include "ApprovalTests.v.10.11.0.hpp"
1+
#include "ApprovalTests.v.10.12.0.hpp"

third_party/approval_tests_cpp/ApprovalTests.v.10.11.0.hpp renamed to third_party/approval_tests_cpp/ApprovalTests.v.10.12.0.hpp

+69-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ApprovalTests.cpp version v.10.11.0
1+
// ApprovalTests.cpp version v.10.12.0
22
// More information at: https://github.com/approvals/ApprovalTests.cpp
33
//
44
// Copyright (c) 2021 Llewellyn Falco and Clare Macrae. All rights reserved.
@@ -26,9 +26,9 @@
2626
// ******************** From: ApprovalTestsVersion.h
2727

2828
#define APPROVAL_TESTS_VERSION_MAJOR 10
29-
#define APPROVAL_TESTS_VERSION_MINOR 11
29+
#define APPROVAL_TESTS_VERSION_MINOR 12
3030
#define APPROVAL_TESTS_VERSION_PATCH 0
31-
#define APPROVAL_TESTS_VERSION_STR "10.11.0"
31+
#define APPROVAL_TESTS_VERSION_STR "10.12.0"
3232

3333
#define APPROVAL_TESTS_VERSION \
3434
(APPROVAL_TESTS_VERSION_MAJOR * 10000 + APPROVAL_TESTS_VERSION_MINOR * 100 + \
@@ -314,7 +314,9 @@ namespace ApprovalTests
314314
ApprovalTests::TestName::registerRootDirectoryFromMainFile(__FILE__);
315315

316316
// ******************** From: EmptyFileCreatorFactory.h
317+
317318
#include <functional>
319+
#include <string>
318320

319321
namespace ApprovalTests
320322
{
@@ -3248,6 +3250,27 @@ namespace ApprovalTests
32483250
};
32493251
}
32503252

3253+
// ******************** From: EmptyFileCreatorByType.h
3254+
3255+
3256+
#include <map>
3257+
#include <string>
3258+
3259+
namespace ApprovalTests
3260+
{
3261+
class EmptyFileCreatorByType
3262+
{
3263+
private:
3264+
static std::map<std::string, EmptyFileCreator> creators_;
3265+
3266+
public:
3267+
static void registerCreator(const std::string& extensionWithDot,
3268+
EmptyFileCreator creator);
3269+
3270+
static void createFile(const std::string& fileName);
3271+
};
3272+
}
3273+
32513274
// ******************** From: ExceptionCollector.h
32523275

32533276
#include <sstream>
@@ -6008,6 +6031,48 @@ namespace ApprovalTests
60086031
}
60096032
}
60106033

6034+
// ******************** From: EmptyFileCreatorByType.cpp
6035+
6036+
namespace
6037+
{
6038+
std::map<std::string, ApprovalTests::EmptyFileCreator>
6039+
defaultEmptyFileCreatorByTypeCreators()
6040+
{
6041+
std::map<std::string, ApprovalTests::EmptyFileCreator> creators;
6042+
ApprovalTests::EmptyFileCreator wibbleCreator = [](std::string fileName) {
6043+
ApprovalTests::StringWriter s("{}");
6044+
s.write(fileName);
6045+
};
6046+
creators[".json"] = wibbleCreator;
6047+
return creators;
6048+
}
6049+
}
6050+
6051+
namespace ApprovalTests
6052+
{
6053+
std::map<std::string, ApprovalTests::EmptyFileCreator>
6054+
EmptyFileCreatorByType::creators_ = defaultEmptyFileCreatorByTypeCreators();
6055+
6056+
void EmptyFileCreatorByType::registerCreator(const std::string& extensionWithDot,
6057+
EmptyFileCreator creator)
6058+
{
6059+
creators_[extensionWithDot] = std::move(creator);
6060+
}
6061+
6062+
void EmptyFileCreatorByType::createFile(const std::string& fileName)
6063+
{
6064+
for (const auto& creator : creators_)
6065+
{
6066+
if (StringUtils::endsWith(fileName, creator.first))
6067+
{
6068+
creator.second(fileName);
6069+
return;
6070+
}
6071+
}
6072+
EmptyFileCreatorFactory::defaultCreator(fileName);
6073+
}
6074+
}
6075+
60116076
// ******************** From: EmptyFileCreatorDisposer.cpp
60126077
#include <sstream>
60136078

@@ -6037,8 +6102,7 @@ namespace ApprovalTests
60376102
}
60386103

60396104
EmptyFileCreator EmptyFileCreatorFactory::currentCreator =
6040-
EmptyFileCreatorFactory::defaultCreator;
6041-
6105+
EmptyFileCreatorByType::createFile;
60426106
}
60436107

60446108
// ******************** From: ExceptionCollector.cpp

0 commit comments

Comments
 (0)