#include <catch_session.h>
Definition at line 19 of file catch_session.h.
◆ Session()
Catch::Session::Session |
( |
| ) |
|
Definition at line 126 of file catch_session.cpp.
126 {
127 static bool alreadyInstantiated = false;
128 if( alreadyInstantiated ) {
131 }
132
133
134#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
136 if ( !exceptions.empty() ) {
137 m_startupExceptions = true;
139 Catch::cerr() <<
"Errors occurred during startup!" <<
'\n';
140
141 for ( const auto& ex_ptr : exceptions ) {
142 try {
143 std::rethrow_exception(ex_ptr);
144 } catch ( std::exception const& ex ) {
145 Catch::cerr() << Column( ex.what() ).indent(2) <<
'\n';
146 }
147 }
148 }
149#endif
150
151 alreadyInstantiated = true;
153 }
#define CATCH_INTERNAL_ERROR(msg)
std::vector< std::exception_ptr > const & getExceptions() const noexcept
IMutableRegistryHub & getMutableRegistryHub()
IRegistryHub const & getRegistryHub()
clara::Parser makeCommandLineParser(ConfigData &config)
virtual void registerStartupException() noexcept=0
virtual StartupExceptionRegistry const & getStartupExceptionRegistry() const =0
◆ ~Session()
Catch::Session::~Session |
( |
| ) |
|
|
override |
◆ applyCommandLine()
int Catch::Session::applyCommandLine |
( |
int | argc, |
|
|
char const *const * | argv ) |
Definition at line 172 of file catch_session.cpp.
172 {
173 if( m_startupExceptions )
174 return 1;
175
177 if( !result ) {
182 << "\nError(s) in input:\n"
183 << Column( result.errorMessage() ).indent( 2 )
184 << "\n\n";
185 Catch::cerr() <<
"Run with -? for usage\n" << std::endl;
186 return MaxExitCode;
187 }
188
193 m_config.reset();
194 return 0;
195 }
IMutableContext & getCurrentMutableContext()
virtual void setConfig(IConfigPtr const &config)=0
auto parse(std::string const &exeName, TokenStream const &tokens) const -> InternalParseResult override
◆ cli() [1/2]
◆ cli() [2/2]
◆ config()
Config & Catch::Session::config |
( |
| ) |
|
Definition at line 248 of file catch_session.cpp.
248 {
249 if( !m_config )
250 m_config = std::make_shared<Config>( m_configData );
251 return *m_config;
252 }
◆ configData()
◆ libIdentify()
void Catch::Session::libIdentify |
( |
| ) |
|
Definition at line 164 of file catch_session.cpp.
164 {
166 << std::left << std::setw(16) << "description: " << "A Catch test executable\n"
167 << std::left << std::setw(16) << "category: " << "testframework\n"
168 << std::left << std::setw(16) << "framework: " << "Catch Test\n"
169 << std::left << std::setw(16) <<
"version: " <<
libraryVersion() << std::endl;
170 }
Version const & libraryVersion()
◆ run() [1/2]
int Catch::Session::run |
( |
| ) |
|
Definition at line 226 of file catch_session.cpp.
226 {
228 Catch::cout() <<
"...waiting for enter/ return before starting" << std::endl;
229 static_cast<void>(std::getchar());
230 }
231 int exitCode = runInternal();
233 Catch::cout() <<
"...waiting for enter/ return before exiting, with code: " << exitCode << std::endl;
234 static_cast<void>(std::getchar());
235 }
236 return exitCode;
237 }
WaitForKeypress::When waitForKeypress
◆ run() [2/2]
template<typename CharT >
int Catch::Session::run |
( |
int | argc, |
|
|
CharT const *const | argv[] ) |
|
inline |
Definition at line 36 of file catch_session.h.
36 {
37 if (m_startupExceptions)
38 return 1;
40 if (returnCode == 0)
42 return returnCode;
43 }
int applyCommandLine(int argc, char const *const *argv)
◆ showHelp()
void Catch::Session::showHelp |
( |
| ) |
const |
Definition at line 158 of file catch_session.cpp.
158 {
161 << m_cli << std::endl
162 << "For more detailed usage please see the project docs\n" << std::endl;
163 }
◆ useConfigData()
void Catch::Session::useConfigData |
( |
ConfigData const & | configData | ) |
|
Definition at line 221 of file catch_session.cpp.
221 {
223 m_config.reset();
224 }
ConfigData & configData()
The documentation for this class was generated from the following files: