|
1 |
| -// ApprovalTests.cpp version v.10.11.0 |
| 1 | +// ApprovalTests.cpp version v.10.12.0 |
2 | 2 | // More information at: https://github.com/approvals/ApprovalTests.cpp
|
3 | 3 | //
|
4 | 4 | // Copyright (c) 2021 Llewellyn Falco and Clare Macrae. All rights reserved.
|
|
26 | 26 | // ******************** From: ApprovalTestsVersion.h
|
27 | 27 |
|
28 | 28 | #define APPROVAL_TESTS_VERSION_MAJOR 10
|
29 |
| -#define APPROVAL_TESTS_VERSION_MINOR 11 |
| 29 | +#define APPROVAL_TESTS_VERSION_MINOR 12 |
30 | 30 | #define APPROVAL_TESTS_VERSION_PATCH 0
|
31 |
| -#define APPROVAL_TESTS_VERSION_STR "10.11.0" |
| 31 | +#define APPROVAL_TESTS_VERSION_STR "10.12.0" |
32 | 32 |
|
33 | 33 | #define APPROVAL_TESTS_VERSION \
|
34 | 34 | (APPROVAL_TESTS_VERSION_MAJOR * 10000 + APPROVAL_TESTS_VERSION_MINOR * 100 + \
|
@@ -314,7 +314,9 @@ namespace ApprovalTests
|
314 | 314 | ApprovalTests::TestName::registerRootDirectoryFromMainFile(__FILE__);
|
315 | 315 |
|
316 | 316 | // ******************** From: EmptyFileCreatorFactory.h
|
| 317 | + |
317 | 318 | #include <functional>
|
| 319 | +#include <string> |
318 | 320 |
|
319 | 321 | namespace ApprovalTests
|
320 | 322 | {
|
@@ -3248,6 +3250,27 @@ namespace ApprovalTests
|
3248 | 3250 | };
|
3249 | 3251 | }
|
3250 | 3252 |
|
| 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 | + |
3251 | 3274 | // ******************** From: ExceptionCollector.h
|
3252 | 3275 |
|
3253 | 3276 | #include <sstream>
|
@@ -6008,6 +6031,48 @@ namespace ApprovalTests
|
6008 | 6031 | }
|
6009 | 6032 | }
|
6010 | 6033 |
|
| 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 | + |
6011 | 6076 | // ******************** From: EmptyFileCreatorDisposer.cpp
|
6012 | 6077 | #include <sstream>
|
6013 | 6078 |
|
@@ -6037,8 +6102,7 @@ namespace ApprovalTests
|
6037 | 6102 | }
|
6038 | 6103 |
|
6039 | 6104 | EmptyFileCreator EmptyFileCreatorFactory::currentCreator =
|
6040 |
| - EmptyFileCreatorFactory::defaultCreator; |
6041 |
| - |
| 6105 | + EmptyFileCreatorByType::createFile; |
6042 | 6106 | }
|
6043 | 6107 |
|
6044 | 6108 | // ******************** From: ExceptionCollector.cpp
|
|
0 commit comments