Specs
Beautiful C++ Test Framework
Loading...
Searching...
No Matches
GlobalSpecEnvironment.h
Go to the documentation of this file.
1#pragma once
2
3#include <Specs/API.h>
4
5namespace SpecsCpp {
6
8 ISpecEnvironment* _environment = nullptr;
9
10 public:
11 ISpecEnvironment* get() const { return _environment; }
12 void set(ISpecEnvironment* environment) { _environment = environment; }
13 };
14
16 static GlobalSpecEnvironment instance;
17 return instance;
18 }
19
20 // Helpers for registration of various things...
21
24 handler
25 );
26 }
27
28 inline void register_reporter(const char* name, ISpecReporter* reporter) {
29 global_spec_environment().get()->reporters()->add(name, reporter);
30 }
31
32 inline void register_runner(const char* name, ISpecRunner* runner) {
33 global_spec_environment().get()->runners()->add(name, runner);
34 }
35}
void set(ISpecEnvironment *environment)
Definition API.h:3
GlobalSpecEnvironment & global_spec_environment()
void register_runner(const char *name, ISpecRunner *runner)
void register_exception_handler(IExceptionHandler *handler)
void register_reporter(const char *name, ISpecReporter *reporter)
virtual void register_exception_handler(ILocalSpecExceptionHandler *)=0
virtual ISpecRunnerCollection * runners() const =0
virtual ISpecReporterCollection * reporters() const =0
virtual ILocalSpecExceptionHandlerCollection * local_exception_handlers() const =0
virtual void add(const char *, ISpecReporter *)=0
virtual void add(const char *, ISpecRunner *)=0