11#include " cucumber_cpp/library/Context.hpp"
22#include " cucumber_cpp/library/StepRegistry.hpp"
33#include " cucumber_cpp/library/cucumber_expression/ParameterRegistry.hpp"
4- #include " cucumber_cpp/library/engine/StepType.hpp"
54#include " gtest/gtest.h"
65#include < cstdint>
76#include < gmock/gmock.h>
@@ -22,43 +21,39 @@ namespace cucumber_cpp::library
2221 TEST_F (TestSteps, RegisterThroughPreregistration)
2322 {
2423 EXPECT_THAT (stepRegistry.Size (), testing::Ge (1 ));
25- EXPECT_THAT (stepRegistry.Size (engine::StepType::given), testing::Ge (1 ));
26- EXPECT_THAT (stepRegistry.Size (engine::StepType::when), testing::Ge (1 ));
27- EXPECT_THAT (stepRegistry.Size (engine::StepType::then), testing::Ge (1 ));
28- EXPECT_THAT (stepRegistry.Size (engine::StepType::any), testing::Ge (1 ));
2924 }
3025
3126 TEST_F (TestSteps, GetGivenStep)
3227 {
33- const auto matches = stepRegistry.Query (engine::StepType::given, " This is a GIVEN step" );
28+ const auto matches = stepRegistry.Query (" This is a GIVEN step" );
3429
3530 EXPECT_THAT (matches.stepRegexStr , testing::StrEq (" ^This is a GIVEN step$" ));
3631 }
3732
3833 TEST_F (TestSteps, GetWhenStep)
3934 {
40- const auto matches = stepRegistry.Query (engine::StepType::when, " This is a WHEN step" );
35+ const auto matches = stepRegistry.Query (" This is a WHEN step" );
4136
4237 EXPECT_THAT (matches.stepRegexStr , testing::StrEq (" ^This is a WHEN step$" ));
4338 }
4439
4540 TEST_F (TestSteps, GetThenStep)
4641 {
47- const auto matches = stepRegistry.Query (engine::StepType::then, " This is a THEN step" );
42+ const auto matches = stepRegistry.Query (" This is a THEN step" );
4843
4944 EXPECT_THAT (matches.stepRegexStr , testing::StrEq (" ^This is a THEN step$" ));
5045 }
5146
5247 TEST_F (TestSteps, GetAnyStep)
5348 {
54- const auto matches = stepRegistry.Query (engine::StepType::given, " This is a STEP step" );
49+ const auto matches = stepRegistry.Query (" This is a STEP step" );
5550
5651 EXPECT_THAT (matches.stepRegexStr , testing::StrEq (" ^This is a STEP step$" ));
5752 }
5853
5954 TEST_F (TestSteps, GetStepWithMatches)
6055 {
61- const auto matches = stepRegistry.Query (engine::StepType::when, " This is a step with a 10s delay" );
56+ const auto matches = stepRegistry.Query (" This is a step with a 10s delay" );
6257
6358 EXPECT_THAT (matches.stepRegexStr , testing::StrEq (" ^This is a step with a ([0-9]+)s delay$" ));
6459
@@ -68,20 +63,20 @@ namespace cucumber_cpp::library
6863
6964 TEST_F (TestSteps, GetInvalidStep)
7065 {
71- EXPECT_THROW ((void )stepRegistry.Query (engine::StepType::when, " This step does not exist" ), StepRegistry::StepNotFoundError);
66+ EXPECT_THROW ((void )stepRegistry.Query (" This step does not exist" ), StepRegistry::StepNotFoundError);
7267 }
7368
7469 TEST_F (TestSteps, GetAmbiguousStep)
7570 {
76- EXPECT_NO_THROW ((void )stepRegistry.Query (engine::StepType::given, " an ambiguous step" ));
77- EXPECT_NO_THROW ((void )stepRegistry.Query (engine::StepType::when, " an ambiguous step" ));
71+ EXPECT_NO_THROW ((void )stepRegistry.Query (" an ambiguous step" ));
72+ EXPECT_NO_THROW ((void )stepRegistry.Query (" an ambiguous step" ));
7873
79- EXPECT_THROW ((void )stepRegistry.Query (engine::StepType::then, " an ambiguous step" ), StepRegistry::AmbiguousStepError);
74+ EXPECT_THROW ((void )stepRegistry.Query (" an ambiguous step" ), StepRegistry::AmbiguousStepError);
8075 }
8176
8277 TEST_F (TestSteps, InvokeTestWithCucumberExpressions)
8378 {
84- const auto matches = stepRegistry.Query (engine::StepType::when, R"( Step with cucumber expression syntax 1.5 "abcdef" 10)" );
79+ const auto matches = stepRegistry.Query (R"( Step with cucumber expression syntax 1.5 "abcdef" 10)" );
8580
8681 auto contextStorage{ std::make_shared<ContextStorageFactoryImpl>() };
8782 Context context{ contextStorage };
@@ -99,16 +94,16 @@ namespace cucumber_cpp::library
9994
10095 TEST_F (TestSteps, EscapedCucumberExpression)
10196 {
102- const auto matchesParens = stepRegistry.Query (engine::StepType::then, R"( An expression with (parenthesis) should remain as is)" );
97+ const auto matchesParens = stepRegistry.Query (R"( An expression with (parenthesis) should remain as is)" );
10398 EXPECT_THAT (matchesParens.stepRegexStr , testing::StrEq (R"( ^An expression with \(parenthesis\) should remain as is$)" ));
10499
105- const auto matchesBrace = stepRegistry.Query (engine::StepType::then, R"( An expression with {braces} should remain as is)" );
100+ const auto matchesBrace = stepRegistry.Query (R"( An expression with {braces} should remain as is)" );
106101 EXPECT_THAT (matchesBrace.stepRegexStr , testing::StrEq (R"( ^An expression with \{braces\} should remain as is$)" ));
107102 }
108103
109104 TEST_F (TestSteps, FunctionLikeStep)
110105 {
111- const auto matches = stepRegistry.Query (engine::StepType::then, R"( An expression that looks like a function func(1, 2) should keep its parameters)" );
106+ const auto matches = stepRegistry.Query (R"( An expression that looks like a function func(1, 2) should keep its parameters)" );
112107
113108 auto contextStorage{ std::make_shared<ContextStorageFactoryImpl>() };
114109 Context context{ contextStorage };
@@ -118,7 +113,7 @@ namespace cucumber_cpp::library
118113
119114 TEST_F (TestSteps, EscapedParenthesis)
120115 {
121- const auto matches1 = stepRegistry.Query (engine::StepType::then, R"( An expression with \(escaped parenthesis\) should keep the slash)" );
122- const auto matches2 = stepRegistry.Query (engine::StepType::then, R"( An expression with \{escaped braces\} should keep the slash)" );
116+ const auto matches1 = stepRegistry.Query (R"( An expression with \(escaped parenthesis\) should keep the slash)" );
117+ const auto matches2 = stepRegistry.Query (R"( An expression with \{escaped braces\} should keep the slash)" );
123118 }
124119}
0 commit comments