mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Ability to register line# for testing
Factored file/ line storage and formatting into common class. Used in a static registry so failure messages can be asserted to have the file/ line in.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
4A6D0C3D149B3D9E00DB3EAA /* MiscTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C34149B3D9E00DB3EAA /* MiscTests.cpp */; };
|
||||
4A6D0C3E149B3D9E00DB3EAA /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C35149B3D9E00DB3EAA /* TestMain.cpp */; };
|
||||
4A6D0C3F149B3D9E00DB3EAA /* TrickyTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C36149B3D9E00DB3EAA /* TrickyTests.cpp */; };
|
||||
4A73282E14E9A6390044823F /* catch_self_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A73282D14E9A6390044823F /* catch_self_test.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@@ -82,6 +83,7 @@
|
||||
4A6D0C66149B3E3D00DB3EAA /* catch_reporter_basic.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_basic.hpp; sourceTree = "<group>"; };
|
||||
4A6D0C67149B3E3D00DB3EAA /* catch_reporter_junit.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_junit.hpp; sourceTree = "<group>"; };
|
||||
4A6D0C68149B3E3D00DB3EAA /* catch_reporter_xml.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_xml.hpp; sourceTree = "<group>"; };
|
||||
4A73282D14E9A6390044823F /* catch_self_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_self_test.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -115,6 +117,8 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4A6D0C35149B3D9E00DB3EAA /* TestMain.cpp */,
|
||||
4A6D0C2E149B3D9E00DB3EAA /* catch_self_test.hpp */,
|
||||
4A73282D14E9A6390044823F /* catch_self_test.cpp */,
|
||||
4A6D0C40149B3DAB00DB3EAA /* Tests */,
|
||||
4A6D0C41149B3DE900DB3EAA /* Catch */,
|
||||
4A6D0C26149B3D3B00DB3EAA /* CatchSelfTest.1 */,
|
||||
@@ -143,7 +147,6 @@
|
||||
4A6D0C44149B3E1500DB3EAA /* catch.hpp */,
|
||||
4A6D0C42149B3E1500DB3EAA /* catch_runner.hpp */,
|
||||
4A6D0C43149B3E1500DB3EAA /* catch_with_main.hpp */,
|
||||
4A6D0C2E149B3D9E00DB3EAA /* catch_self_test.hpp */,
|
||||
4A6D0C45149B3E3D00DB3EAA /* internal */,
|
||||
4A6D0C65149B3E3D00DB3EAA /* reporters */,
|
||||
);
|
||||
@@ -259,6 +262,7 @@
|
||||
4A6D0C3D149B3D9E00DB3EAA /* MiscTests.cpp in Sources */,
|
||||
4A6D0C3E149B3D9E00DB3EAA /* TestMain.cpp in Sources */,
|
||||
4A6D0C3F149B3D9E00DB3EAA /* TrickyTests.cpp in Sources */,
|
||||
4A73282E14E9A6390044823F /* catch_self_test.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -343,6 +347,7 @@
|
||||
4A6D0C2C149B3D3B00DB3EAA /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* catch_self_test.cpp
|
||||
* Catch
|
||||
*
|
||||
* Created by Phil on 14/02/2012.
|
||||
* Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch_self_test.hpp"
|
||||
|
||||
namespace Catch
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
std::size_t EmbeddedRunner::runMatching
|
||||
(
|
||||
const std::string& rawTestSpec
|
||||
)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
Config config;
|
||||
config.setStreamBuf( oss.rdbuf() );
|
||||
config.setReporter( "basic" );
|
||||
|
||||
std::size_t result;
|
||||
|
||||
// Scoped because Runner doesn't report EndTesting until its destructor
|
||||
{
|
||||
Runner runner( config );
|
||||
result = runner.runMatching( rawTestSpec );
|
||||
m_successes = runner.getSuccessCount();
|
||||
m_failures = runner.getFailureCount();
|
||||
}
|
||||
m_output = oss.str();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user