1 /* 2 * Created by Martin on 25/07/2017. 3 * 4 * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 */ 7 8 #include "catch_test_registry.h" 9 #include "catch_compiler_capabilities.h" 10 #include "catch_test_case_registry_impl.h" 11 #include "catch_interfaces_registry_hub.h" 12 13 namespace Catch { 14 makeTestInvoker(void (* testAsFunction)())15 auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* { 16 return new(std::nothrow) TestInvokerAsFunction( testAsFunction ); 17 } 18 NameAndTags(StringRef const & name_,StringRef const & tags_)19 NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {} 20 AutoReg(ITestInvoker * invoker,SourceLineInfo const & lineInfo,StringRef const & classOrMethod,NameAndTags const & nameAndTags)21 AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { 22 CATCH_TRY { 23 getMutableRegistryHub() 24 .registerTest( 25 makeTestCase( 26 invoker, 27 extractClassName( classOrMethod ), 28 nameAndTags, 29 lineInfo)); 30 } CATCH_CATCH_ALL { 31 // Do not throw when constructing global objects, instead register the exception to be processed later 32 getMutableRegistryHub().registerStartupException(); 33 } 34 } 35 36 AutoReg::~AutoReg() = default; 37 } 38