40 struct ScenarioCase::Impl {
42 std::string section_path;
49 std::vector<Section> children;
52 ScenarioCase::Impl* pimpl_,
56 const RunnerFilter& filter_)
const;
58 std::vector<Section> sections;
62 const Impl&) =
delete;
64 const Impl&) =
delete;
67 const std::string& name_,
68 const std::string& section_path_,
74 ScenarioCase::Impl::Impl(
75 const std::string& name_,
76 const std::string& section_path_,
80 section_path(section_path_),
82 repeater_factory(repeater_factory_),
84 assert(!name.empty() && repeater_factory !=
nullptr);
88 ScenarioCase::Impl::~Impl() {
92 void ScenarioCase::Impl::Section::filterScenario(
97 const RunnerFilter& filter_)
const {
100 tags_.pushTags(name, pimpl_->tags);
102 if(children.empty()) {
104 if(!filter_.filterPath(tags_)) {
105 parent_->appendScenario(
106 std::make_shared<ScenarioCase>(
107 pimpl_->name, path_.getCurrentPath(), pimpl_->tags, pimpl_->repeater_factory));
112 for(
const auto& scenario_ : children)
113 scenario_.filterScenario(pimpl_, path_, tags_, parent_, filter_);
122 const std::string& name_,
125 pimpl(new Impl(name_, std::string(), tags_, repeater_factory_)) {
130 const std::string& name_,
131 const std::string& section_path_,
134 pimpl(new Impl(name_, section_path_, tags_, repeater_factory_)) {
139 const std::string& name_,
154 tags_.
pushTags(pimpl->name, pimpl->tags);
156 if(pimpl->sections.empty()) {
159 parent_->appendScenario(
160 std::make_shared<ScenarioCase>(
161 pimpl->name, pimpl->tags, pimpl->repeater_factory));
167 for(
const auto& scenario : pimpl->sections)
168 scenario.filterScenario(pimpl, path_, tags_, parent_, filter_);
178 const Context& context_)
const {
179 return {pimpl->name, pimpl->repeater_factory->createRepeater(context_, pimpl->section_path)};
183 const Context& context_)
const noexcept {
185 if(!pimpl->section_path.empty())
186 context_.object_path->appendParameter(
"section", pimpl->section_path);
189 context_.reporter->enterCase(
191 context_.object_path->getCurrentName(),
192 context_.object_path->getCurrentParameters());
196 const Context& context_)
const noexcept {
197 context_.reporter->leaveCase(
199 context_.object_path->getCurrentName(),
200 context_.object_path->getCurrentParameters(),
201 context_.semantic_stack->top());
209 struct ScenarioCaseBuilder::Impl {
212 std::vector<ScenarioCase::Impl::Section*> section_stack;
216 const Impl&) =
delete;
218 const Impl&) =
delete;
221 const std::string& name_,
227 ScenarioCaseBuilder::Impl::Impl(
228 const std::string& name_,
231 scenario(std::make_shared<ScenarioCase>(name_, tags_, repeater_factory_)),
232 scenario_case(static_cast<ScenarioCase*>(scenario.get())),
237 ScenarioCaseBuilder::Impl::~Impl() {
242 const std::string& name_,
245 pimpl(new Impl(name_, tags_, repeater_factory_)) {
251 pimpl(other_.pimpl) {
252 other_.pimpl =
nullptr;
260 const std::string& name_) {
261 assert(!name_.empty());
263 if(pimpl->section_stack.empty()) {
264 pimpl->scenario_case->pimpl->sections.push_back(ScenarioCase::Impl::Section{name_, {}});
265 pimpl->section_stack.push_back(&pimpl->scenario_case->pimpl->sections.back());
268 auto top_(pimpl->section_stack.back());
269 top_->children.push_back(ScenarioCase::Impl::Section{name_, {}});
270 pimpl->section_stack.push_back(&top_->children.back());
277 assert(!pimpl->section_stack.empty());
278 pimpl->section_stack.pop_back();
284 return pimpl->scenario;