Skip to content

Commit 999d915

Browse files
committed
v.10.13.0
1 parent 19b768c commit 999d915

3 files changed

Lines changed: 113 additions & 27 deletions

File tree

lib/ApprovalTests.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#include "ApprovalTests.v.10.12.2.hpp"
1+
#include "ApprovalTests.v.10.13.0.hpp"
Lines changed: 111 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// ApprovalTests.cpp version v.10.12.2
1+
// ApprovalTests.cpp version v.10.13.0
22
// More information at: https://github.com/approvals/ApprovalTests.cpp
33
//
4-
// Copyright (c) 2022 Llewellyn Falco and Clare Macrae. All rights reserved.
4+
// Copyright (c) 2024 Llewellyn Falco and Clare Macrae. All rights reserved.
55
//
66
// Distributed under the Apache 2.0 License
77
// See https://opensource.org/licenses/Apache-2.0
@@ -26,9 +26,9 @@
2626
// ******************** From: ApprovalTestsVersion.h
2727

2828
#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"
3232

3333
#define APPROVAL_TESTS_VERSION \
3434
(APPROVAL_TESTS_VERSION_MAJOR * 10000 + APPROVAL_TESTS_VERSION_MINOR * 100 + \
@@ -127,6 +127,11 @@ namespace ApprovalTests
127127
{
128128
namespace DiffPrograms
129129
{
130+
namespace CrossPlatform
131+
{
132+
DiffInfo VS_CODE();
133+
}
134+
130135
namespace Mac
131136
{
132137
DiffInfo DIFF_MERGE();
@@ -382,25 +387,6 @@ namespace ApprovalTests
382387
#define APPROVAL_TESTS_MINGW
383388
#endif
384389

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-
404390
// ******************** From: StringMaker.h
405391

406392
#include <string>
@@ -2315,6 +2301,55 @@ struct Catch2TestCommitRevert : Catch::TestEventListenerBase
23152301
CATCH_REGISTER_LISTENER(Catch2TestCommitRevert)
23162302
#endif
23172303

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(&currentTest);
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+
23182353
// ******************** From: CppUTestApprovals.h
23192354

23202355

@@ -2911,6 +2946,27 @@ namespace ApprovalTests
29112946
};
29122947
}
29132948

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+
29142970
// ******************** From: CustomReporter.h
29152971

29162972
#include <memory>
@@ -4966,6 +5022,27 @@ namespace ApprovalTests
49665022
}
49675023
}
49685024

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+
49695046
// ******************** From: CustomReporter.cpp
49705047

49715048
namespace ApprovalTests
@@ -5149,6 +5226,12 @@ namespace ApprovalTests
51495226
namespace DiffPrograms
51505227
{
51515228

5229+
namespace CrossPlatform
5230+
{
5231+
APPROVAL_TESTS_MACROS_ENTRY(
5232+
VS_CODE, DiffInfo("code", "-d {Received} {Approved}", Type::TEXT))
5233+
}
5234+
51525235
namespace Mac
51535236
{
51545237
APPROVAL_TESTS_MACROS_ENTRY(
@@ -5322,7 +5405,8 @@ namespace ApprovalTests
53225405
: FirstWorkingReporter({new EnvironmentVariableReporter(),
53235406
new Mac::MacDiffReporter(),
53245407
new Linux::LinuxDiffReporter(),
5325-
new Windows::WindowsDiffReporter()})
5408+
new Windows::WindowsDiffReporter(),
5409+
new CrossPlatform::CrossPlatformDiffReporter()})
53265410
{
53275411
}
53285412
}
@@ -5693,6 +5777,8 @@ namespace ApprovalTests
56935777
APPROVAL_TESTS_REGISTER_REPORTER(Windows::KDiff3Reporter);
56945778
APPROVAL_TESTS_REGISTER_REPORTER(Windows::VisualStudioCodeReporter);
56955779

5780+
APPROVAL_TESTS_REGISTER_REPORTER(CrossPlatform::VisualStudioCodeReporter);
5781+
56965782
return map;
56975783
}
56985784

visual-studio-2019/StarterProject2019.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
<ItemGroup>
146146
<ClInclude Include="..\code\YourCodeGoesHere.h" />
147147
<ClInclude Include="..\lib\ApprovalTests.hpp" />
148-
<ClInclude Include="..\lib\ApprovalTests.v.10.12.2.hpp" />
148+
<ClInclude Include="..\lib\ApprovalTests.v.10.13.0.hpp" />
149149
<ClInclude Include="..\lib\catch2\include\catch2\catch.hpp" />
150150
<ClInclude Include="..\lib\catch2\include\catch2\catch.v2.13.10.hpp" />
151151
</ItemGroup>

0 commit comments

Comments
 (0)