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_test_case_registry_impl.h" 10 #include "catch_interfaces_registry_hub.h" 11 12 namespace Catch { 13 makeTestInvoker(void (* testAsFunction)())14 auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* { 15 return new(std::nothrow) TestInvokerAsFunction( testAsFunction ); 16 } 17 NameAndTags(StringRef const & name_,StringRef const & tags_)18 NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {} 19 AutoReg(ITestInvoker * invoker,SourceLineInfo const & lineInfo,StringRef const & classOrMethod,NameAndTags const & nameAndTags)20 AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { 21 try { 22 getMutableRegistryHub() 23 .registerTest( 24 makeTestCase( 25 invoker, 26 extractClassName( classOrMethod ), 27 nameAndTags, 28 lineInfo)); 29 } catch (...) { 30 // Do not throw when constructing global objects, instead register the exception to be processed later 31 getMutableRegistryHub().registerStartupException(); 32 } 33 } 34 35 AutoReg::~AutoReg() = default; 36 } 37