|
1 | | -// ApprovalTests.cpp version v.10.12.2 |
| 1 | +// ApprovalTests.cpp version v.10.13.0 |
2 | 2 | // More information at: https://github.com/approvals/ApprovalTests.cpp |
3 | 3 | // |
4 | | -// Copyright (c) 2022 Llewellyn Falco and Clare Macrae. All rights reserved. |
| 4 | +// Copyright (c) 2024 Llewellyn Falco and Clare Macrae. All rights reserved. |
5 | 5 | // |
6 | 6 | // Distributed under the Apache 2.0 License |
7 | 7 | // See https://opensource.org/licenses/Apache-2.0 |
|
26 | 26 | // ******************** From: ApprovalTestsVersion.h |
27 | 27 |
|
28 | 28 | #define APPROVAL_TESTS_VERSION_MAJOR 10 |
29 | | -#define APPROVAL_TESTS_VERSION_MINOR 12 |
30 | | -#define APPROVAL_TESTS_VERSION_PATCH 2 |
31 | | -#define APPROVAL_TESTS_VERSION_STR "10.12.2" |
| 29 | +#define APPROVAL_TESTS_VERSION_MINOR 13 |
| 30 | +#define APPROVAL_TESTS_VERSION_PATCH 0 |
| 31 | +#define APPROVAL_TESTS_VERSION_STR "10.13.0" |
32 | 32 |
|
33 | 33 | #define APPROVAL_TESTS_VERSION \ |
34 | 34 | (APPROVAL_TESTS_VERSION_MAJOR * 10000 + APPROVAL_TESTS_VERSION_MINOR * 100 + \ |
@@ -127,6 +127,11 @@ namespace ApprovalTests |
127 | 127 | { |
128 | 128 | namespace DiffPrograms |
129 | 129 | { |
| 130 | + namespace CrossPlatform |
| 131 | + { |
| 132 | + DiffInfo VS_CODE(); |
| 133 | + } |
| 134 | + |
130 | 135 | namespace Mac |
131 | 136 | { |
132 | 137 | DiffInfo DIFF_MERGE(); |
@@ -382,25 +387,6 @@ namespace ApprovalTests |
382 | 387 | #define APPROVAL_TESTS_MINGW |
383 | 388 | #endif |
384 | 389 |
|
385 | | -#ifdef APPROVAL_TESTS_MINGW |
386 | | -#ifdef __cplusplus |
387 | | -extern "C" |
388 | | -{ |
389 | | -#endif |
390 | | - |
391 | | -#include <sec_api/stdlib_s.h> /* errno_t, size_t */ |
392 | | - |
393 | | - errno_t getenv_s(size_t* ret_required_buf_size, |
394 | | - char* buf, |
395 | | - size_t buf_size_in_bytes, |
396 | | - const char* name); |
397 | | - |
398 | | -#ifdef __cplusplus |
399 | | -} |
400 | | -#endif |
401 | | - |
402 | | -#endif // APPROVAL_TESTS_MINGW |
403 | | - |
404 | 390 | // ******************** From: StringMaker.h |
405 | 391 |
|
406 | 392 | #include <string> |
@@ -2315,6 +2301,55 @@ struct Catch2TestCommitRevert : Catch::TestEventListenerBase |
2315 | 2301 | CATCH_REGISTER_LISTENER(Catch2TestCommitRevert) |
2316 | 2302 | #endif |
2317 | 2303 |
|
| 2304 | +// ******************** From: Catch2v3Approvals.h |
| 2305 | + |
| 2306 | + |
| 2307 | +#ifdef APPROVALS_CATCH2_V3 |
| 2308 | +#define APPROVAL_TESTS_INCLUDE_CPPS |
| 2309 | + |
| 2310 | +#include <catch2/reporters/catch_reporter_event_listener.hpp> |
| 2311 | +#include <catch2/catch_test_macros.hpp> |
| 2312 | +#include <catch2/reporters/catch_reporter_registrars.hpp> |
| 2313 | +#include <catch2/catch_test_case_info.hpp> |
| 2314 | + |
| 2315 | +//namespace ApprovalTests { |
| 2316 | +struct Catch2ApprovalListener : Catch::EventListenerBase |
| 2317 | +{ |
| 2318 | + ApprovalTests::TestName currentTest; |
| 2319 | + using EventListenerBase:: |
| 2320 | + EventListenerBase; // This using allows us to use all base-class constructors |
| 2321 | + virtual void testCaseStarting(Catch::TestCaseInfo const& testInfo) override |
| 2322 | + { |
| 2323 | + |
| 2324 | + currentTest.setFileName(testInfo.lineInfo.file); |
| 2325 | + ApprovalTests::FrameworkIntegrations::setCurrentTest(¤tTest); |
| 2326 | + ApprovalTests::FrameworkIntegrations::setTestPassedNotification( |
| 2327 | + []() { REQUIRE(true); }); |
| 2328 | + } |
| 2329 | + |
| 2330 | + virtual void testCaseEnded(Catch::TestCaseStats const& /*testCaseStats*/) override |
| 2331 | + { |
| 2332 | + while (!currentTest.sections.empty()) |
| 2333 | + { |
| 2334 | + currentTest.sections.pop_back(); |
| 2335 | + } |
| 2336 | + } |
| 2337 | + |
| 2338 | + virtual void sectionStarting(Catch::SectionInfo const& sectionInfo) override |
| 2339 | + { |
| 2340 | + currentTest.sections.push_back(sectionInfo.name); |
| 2341 | + } |
| 2342 | + |
| 2343 | + virtual void sectionEnded(Catch::SectionStats const& /*sectionStats*/) override |
| 2344 | + { |
| 2345 | + currentTest.sections.pop_back(); |
| 2346 | + } |
| 2347 | +}; |
| 2348 | +//} |
| 2349 | +CATCH_REGISTER_LISTENER(Catch2ApprovalListener) |
| 2350 | + |
| 2351 | +#endif |
| 2352 | + |
2318 | 2353 | // ******************** From: CppUTestApprovals.h |
2319 | 2354 |
|
2320 | 2355 |
|
@@ -2911,6 +2946,27 @@ namespace ApprovalTests |
2911 | 2946 | }; |
2912 | 2947 | } |
2913 | 2948 |
|
| 2949 | +// ******************** From: CrossPlatformReporters.h |
| 2950 | + |
| 2951 | + |
| 2952 | +namespace ApprovalTests |
| 2953 | +{ |
| 2954 | + namespace CrossPlatform |
| 2955 | + { |
| 2956 | + class VisualStudioCodeReporter : public GenericDiffReporter |
| 2957 | + { |
| 2958 | + public: |
| 2959 | + VisualStudioCodeReporter(); |
| 2960 | + }; |
| 2961 | + |
| 2962 | + class CrossPlatformDiffReporter : public FirstWorkingReporter |
| 2963 | + { |
| 2964 | + public: |
| 2965 | + CrossPlatformDiffReporter(); |
| 2966 | + }; |
| 2967 | + } |
| 2968 | +} |
| 2969 | + |
2914 | 2970 | // ******************** From: CustomReporter.h |
2915 | 2971 |
|
2916 | 2972 | #include <memory> |
@@ -4966,6 +5022,27 @@ namespace ApprovalTests |
4966 | 5022 | } |
4967 | 5023 | } |
4968 | 5024 |
|
| 5025 | +// ******************** From: CrossPlatformReporters.cpp |
| 5026 | + |
| 5027 | + |
| 5028 | +namespace ApprovalTests |
| 5029 | +{ |
| 5030 | + namespace CrossPlatform |
| 5031 | + { |
| 5032 | + VisualStudioCodeReporter::VisualStudioCodeReporter() |
| 5033 | + : GenericDiffReporter(DiffPrograms::CrossPlatform::VS_CODE()) |
| 5034 | + { |
| 5035 | + } |
| 5036 | + |
| 5037 | + CrossPlatformDiffReporter::CrossPlatformDiffReporter() |
| 5038 | + : FirstWorkingReporter({ |
| 5039 | + new VisualStudioCodeReporter(), |
| 5040 | + }) |
| 5041 | + { |
| 5042 | + } |
| 5043 | + } |
| 5044 | +} |
| 5045 | + |
4969 | 5046 | // ******************** From: CustomReporter.cpp |
4970 | 5047 |
|
4971 | 5048 | namespace ApprovalTests |
@@ -5149,6 +5226,12 @@ namespace ApprovalTests |
5149 | 5226 | namespace DiffPrograms |
5150 | 5227 | { |
5151 | 5228 |
|
| 5229 | + namespace CrossPlatform |
| 5230 | + { |
| 5231 | + APPROVAL_TESTS_MACROS_ENTRY( |
| 5232 | + VS_CODE, DiffInfo("code", "-d {Received} {Approved}", Type::TEXT)) |
| 5233 | + } |
| 5234 | + |
5152 | 5235 | namespace Mac |
5153 | 5236 | { |
5154 | 5237 | APPROVAL_TESTS_MACROS_ENTRY( |
@@ -5322,7 +5405,8 @@ namespace ApprovalTests |
5322 | 5405 | : FirstWorkingReporter({new EnvironmentVariableReporter(), |
5323 | 5406 | new Mac::MacDiffReporter(), |
5324 | 5407 | new Linux::LinuxDiffReporter(), |
5325 | | - new Windows::WindowsDiffReporter()}) |
| 5408 | + new Windows::WindowsDiffReporter(), |
| 5409 | + new CrossPlatform::CrossPlatformDiffReporter()}) |
5326 | 5410 | { |
5327 | 5411 | } |
5328 | 5412 | } |
@@ -5693,6 +5777,8 @@ namespace ApprovalTests |
5693 | 5777 | APPROVAL_TESTS_REGISTER_REPORTER(Windows::KDiff3Reporter); |
5694 | 5778 | APPROVAL_TESTS_REGISTER_REPORTER(Windows::VisualStudioCodeReporter); |
5695 | 5779 |
|
| 5780 | + APPROVAL_TESTS_REGISTER_REPORTER(CrossPlatform::VisualStudioCodeReporter); |
| 5781 | + |
5696 | 5782 | return map; |
5697 | 5783 | } |
5698 | 5784 |
|
|
0 commit comments