Specs
Beautiful C++ Test Framework
Loading...
Searching...
No Matches
SpecEnvironment.h
Go to the documentation of this file.
1#pragma once
2
3#include <Specs/API.h>
4
5#include <memory>
6
8#include "SpecGroup.h"
11
12namespace SpecsCpp {
13
15 ISpecOutput* _standard_output;
16 ISpecOutput* _error_output;
17 std::unique_ptr<SpecGroup> _root_group;
18 std::unique_ptr<SpecReporterCollection> _reporters;
19 std::unique_ptr<SpecRunnerCollection> _runners;
20 std::unique_ptr<LocalSpecExceptionHandlerCollection> _local_exception_handlers;
21
22 public:
24 : _root_group(std::make_unique<SpecGroup>()),
25 _reporters(std::make_unique<SpecReporterCollection>()),
26 _runners(std::make_unique<SpecRunnerCollection>()),
27 _local_exception_handlers(std::make_unique<LocalSpecExceptionHandlerCollection>()) {}
28
29 ISpecGroup* root_group() const override { return _root_group.get(); }
30
31 ISpecOutput* standard_output() const override { return _standard_output; }
32 void set_standard_output(ISpecOutput* output) override { _standard_output = output; }
33
34 ISpecOutput* error_output() const override { return _error_output; }
35 void set_error_output(ISpecOutput* output) override { _error_output = output; }
36
38 return _local_exception_handlers.get();
39 }
40
41 ISpecRunnerCollection* runners() const override { return _runners.get(); }
42
43 ISpecReporterCollection* reporters() const override { return _reporters.get(); }
44
45 void run(
48 ) override {
49 runner->run(root_group(), reporters, options, callback);
50 }
51 };
52}
ISpecGroup * root_group() const override
void set_standard_output(ISpecOutput *output) override
ISpecReporterCollection * reporters() const override
void run(ISpecRunner *runner, ISpecReporterCollection *reporters, ISpecRunOptions *options, ISpecSuiteRunResultCallbackFn *callback) override
ISpecRunnerCollection * runners() const override
ILocalSpecExceptionHandlerCollection * local_exception_handlers() const override
ISpecOutput * standard_output() const override
ISpecOutput * error_output() const override
void set_error_output(ISpecOutput *output) override
Definition API.h:3
IFunctionPointer< void(ISpecSuiteRunResult *)> ISpecSuiteRunResultCallbackFn
Definition API.h:485
virtual ISpecReporter * get(const char *name) const =0
virtual ISpecRunner * get(const char *name) const =0
virtual void run(ISpecGroup *, ISpecReporterCollection *, ISpecRunOptions *options, ISpecSuiteRunResultCallbackFn *)=0