File tree Expand file tree Collapse file tree 3 files changed +21
-8
lines changed
cucumber_cpp/library/engine Expand file tree Collapse file tree 3 files changed +21
-8
lines changed Original file line number Diff line number Diff line change 99#include < set>
1010#include < stdexcept>
1111#include < string>
12+ #include < utility>
1213
1314namespace cucumber_cpp ::library::engine
1415{
@@ -26,17 +27,14 @@ namespace cucumber_cpp::library::engine
2627
2728 struct ThrowPolicy
2829 {
29- protected:
30- ~ThrowPolicy () = default ;
31-
32- public:
30+ virtual ~ThrowPolicy () = default ;
3331 virtual void Throw () const = 0;
3432 };
3533
3634 struct ThrowExceptionPolicy : ThrowPolicy
3735 {
38- ThrowExceptionPolicy (std::string message)
39- : message{ message }
36+ explicit ThrowExceptionPolicy (std::string message)
37+ : message{ std::move ( message) }
4038 {}
4139
4240 void Throw () const override
Original file line number Diff line number Diff line change @@ -77,6 +77,9 @@ namespace cucumber_cpp::library::engine
7777 report::test_helper::ReportForwarderMock reportHandler{ *contextManagerInstance };
7878 TestAssertionHandlerImpl assertionHandler{ *contextManagerInstance, reportHandler };
7979
80- EXPECT_ANY_THROW (auto scope = hookExecutor->StepStart ());
80+ EXPECT_ANY_THROW ([this ]
81+ {
82+ auto hook = hookExecutor->StepStart ();
83+ }());
8184 }
8285}
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ namespace cucumber_cpp::library::engine
8080
8181 struct TestTestRunner : testing::Test
8282 {
83- TestExecutionMockInstance testExecutionMock;
83+ testing::StrictMock< TestExecutionMockInstance> testExecutionMock;
8484 TestRunnerImpl runner{ testExecutionMock };
8585
8686 FeatureTreeFactory featureTreeFactory;
@@ -110,6 +110,18 @@ namespace cucumber_cpp::library::engine
110110 runner.Run (features);
111111 }
112112
113+ TEST_F (TestTestRunner, DontRunEmptyFeature)
114+ {
115+ EXPECT_CALL (testExecutionMock, StartRunMock);
116+ EXPECT_CALL (testExecutionMock, StartFeatureMock).Times (0 );
117+
118+ auto tmp = test_helper::TemporaryFile{ " tmpfile.feature" };
119+ tmp << " Feature: Test feature\n " ;
120+ features.push_back (featureTreeFactory.Create (tmp.Path (), " " ));
121+
122+ runner.Run (features);
123+ }
124+
113125 TEST_F (TestTestRunner, StartFeatureContextForEveryFeature)
114126 {
115127 EXPECT_CALL (testExecutionMock, StartRunMock);
You can’t perform that action at this time.
0 commit comments