Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cucumber_cpp/library/engine/ContextManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ namespace cucumber_cpp::library::engine
{
}

ContextManager::ScopedFeautureContext::ScopedFeautureContext(ContextManager& contextManager)
ContextManager::ScopedFeatureContext::ScopedFeatureContext(ContextManager& contextManager)
: contextManager{ contextManager }
{}

ContextManager::ScopedFeautureContext ::~ScopedFeautureContext()
ContextManager::ScopedFeatureContext::~ScopedFeatureContext()
{
contextManager.DisposeFeatureContext();
}
Expand All @@ -90,7 +90,7 @@ namespace cucumber_cpp::library::engine
: contextManager{ contextManager }
{}

ContextManager::ScopedRuleContext ::~ScopedRuleContext()
ContextManager::ScopedRuleContext::~ScopedRuleContext()
{
contextManager.DisposeRuleContext();
}
Expand All @@ -99,7 +99,7 @@ namespace cucumber_cpp::library::engine
: contextManager{ contextManager }
{}

ContextManager::ScopedScenarioContext ::~ScopedScenarioContext()
ContextManager::ScopedScenarioContext::~ScopedScenarioContext()
{
contextManager.DisposeScenarioContext();
}
Expand Down Expand Up @@ -129,12 +129,12 @@ namespace cucumber_cpp::library::engine
return *programContext;
}

ContextManager::ScopedFeautureContext ContextManager::CreateFeatureContext(const FeatureInfo& featureInfo)
ContextManager::ScopedFeatureContext ContextManager::CreateFeatureContext(const FeatureInfo& featureInfo)
{
featureContext = std::make_shared<decltype(featureContext)::element_type>(*programContext, featureInfo);
runnerContext.push(featureContext);

return ScopedFeautureContext{ *this };
return ScopedFeatureContext{ *this };
}

void ContextManager::DisposeFeatureContext()
Expand Down
10 changes: 5 additions & 5 deletions cucumber_cpp/library/engine/ContextManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ namespace cucumber_cpp::library::engine
cucumber_cpp::library::engine::ProgramContext& ProgramContext();
[[nodiscard]] cucumber_cpp::library::engine::ProgramContext& ProgramContext() const;

struct ScopedFeautureContext;
struct ScopedFeatureContext;
struct ScopedRuleContext;
struct ScopedScenarioContext;
struct ScopedStepContext;

[[nodiscard]] ScopedFeautureContext CreateFeatureContext(const FeatureInfo& featureInfo);
[[nodiscard]] ScopedFeatureContext CreateFeatureContext(const FeatureInfo& featureInfo);
cucumber_cpp::library::engine::FeatureContext& FeatureContext();

[[nodiscard]] ScopedRuleContext CreateRuleContext(const RuleInfo& ruleInfo);
Expand Down Expand Up @@ -109,10 +109,10 @@ namespace cucumber_cpp::library::engine
std::stack<std::shared_ptr<cucumber_cpp::library::engine::StepContext>> stepContext;
};

struct ContextManager::ScopedFeautureContext : library::util::Immoveable
struct ContextManager::ScopedFeatureContext : library::util::Immoveable
{
explicit ScopedFeautureContext(ContextManager& contextManager);
~ScopedFeautureContext();
explicit ScopedFeatureContext(ContextManager& contextManager);
~ScopedFeatureContext();

private:
ContextManager& contextManager;
Expand Down
2 changes: 1 addition & 1 deletion cucumber_cpp/library/engine/HookExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace cucumber_cpp::library::engine
{}

HookExecutor::StepScope::StepScope(cucumber_cpp::library::engine::ContextManager& contextManager)
: ScopedHook{ contextManager.StepContext(), stepHooks, contextManager.ScenarioContext().info.Tags() }
: ScopedHook{ contextManager.ScenarioContext(), stepHooks, contextManager.ScenarioContext().info.Tags() }
{}

HookExecutorImpl::HookExecutorImpl(cucumber_cpp::library::engine::ContextManager& contextManager)
Expand Down
2 changes: 1 addition & 1 deletion cucumber_cpp/library/engine/TestExecution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace cucumber_cpp::library::engine
FeatureScope(cucumber_cpp::library::engine::ContextManager& contextManager, report::ReportForwarder& reportHandler, HookExecutor& hookExecution, const cucumber_cpp::library::engine::FeatureInfo& featureInfo);

private:
cucumber_cpp::library::engine::ContextManager::ScopedFeautureContext scopedFeatureContext;
cucumber_cpp::library::engine::ContextManager::ScopedFeatureContext scopedFeatureContext;
report::ReportForwarder::FeatureScope scopedFeatureReport;
HookExecutor::FeatureScope scopedFeatureHook;
};
Expand Down
8 changes: 4 additions & 4 deletions cucumber_cpp/library/engine/test/TestHookExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ namespace cucumber_cpp::library::engine

TEST_F(TestHookExecutor, ExecuteBeforeStep)
{
ASSERT_FALSE(contextManagerInstance.StepContext().Contains("hookBeforeStep"));
ASSERT_FALSE(contextManagerInstance.StepContext().Contains("hookAfterStep"));
ASSERT_FALSE(contextManagerInstance.ScenarioContext().Contains("hookBeforeStep"));
ASSERT_FALSE(contextManagerInstance.ScenarioContext().Contains("hookAfterStep"));

{
auto scope = hookExecutor.StepStart();
EXPECT_TRUE(contextManagerInstance.StepContext().Contains("hookBeforeStep"));
EXPECT_TRUE(contextManagerInstance.ScenarioContext().Contains("hookBeforeStep"));
}
EXPECT_TRUE(contextManagerInstance.StepContext().Contains("hookAfterStep"));
EXPECT_TRUE(contextManagerInstance.ScenarioContext().Contains("hookAfterStep"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ namespace cucumber_cpp::library::engine::test_helper
{
ContextManagerInstance()
: cucumber_cpp::library::engine::ContextManager{ contextStorageFactory }
, featureContextScope{ CreateFeatureContext(feature) }
, ruleContextScope{ CreateRuleContext(rule) }
, scenarioContextScope{ CreateScenarioContext(scenario) }
, stepContextScope{ CreateStepContext(step) }
{
}

Expand All @@ -35,10 +31,10 @@ namespace cucumber_cpp::library::engine::test_helper
cucumber_cpp::library::engine::ScenarioInfo scenario{ rule, {}, {}, {}, {}, {} };
cucumber_cpp::library::engine::StepInfo step{ scenario, {}, {}, {}, {}, {} };

ContextManager::ScopedFeautureContext featureContextScope;
ContextManager::ScopedRuleContext ruleContextScope;
ContextManager::ScopedScenarioContext scenarioContextScope;
ContextManager::ScopedStepContext stepContextScope;
ContextManager::ScopedFeatureContext featureContextScope{ CreateFeatureContext(feature) };
ContextManager::ScopedRuleContext ruleContextScope{ CreateRuleContext(rule) };
ContextManager::ScopedScenarioContext scenarioContextScope{ CreateScenarioContext(scenario) };
ContextManager::ScopedStepContext stepContextScope{ CreateStepContext(step) };
};
}

Expand Down
Loading