-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: - Steps are only matched by the name which prevents multiple steps on different lines to be used as the first match will be always taken. Solution: - Follow also the line step next to the name so that steps with the same name can be distinguished. In order for the step to match the name has to match and the line of given step has to be greater/equal than the line of the currently processed step.
- Loading branch information
1 parent
1d9cdde
commit 2acebc1
Showing
5 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Copyright (c) 2016-2017 Kris Jusiak (kris at jusiak dot net) | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
#include "GUnit/GSteps.h" | ||
#include "GUnit/GAssert.h" | ||
|
||
GSTEPS("Repeat*") { | ||
int step{}; | ||
Given("I have a multiline text", "{steps}") = [&](const testing::Table& table) { | ||
if (step == 0) { | ||
EXPECT("first line" == table.text); | ||
} else { | ||
EXPECT("second line" == table.text); | ||
} | ||
++step; | ||
}; | ||
Given("I print it") = [] { }; | ||
Given("I should see", "{steps}") = [&](const testing::Table& table) { | ||
if (step == 1) { | ||
EXPECT("first line" == table.text); | ||
} else { | ||
EXPECT("first linesecond line" == table.text); | ||
} | ||
++step; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Feature: Repeat | ||
Scenario: Repeating steps | ||
Given I have a multiline text | ||
""" | ||
first line | ||
""" | ||
When I print it | ||
Then I should see | ||
""" | ||
first line | ||
""" | ||
And I have a multiline text | ||
""" | ||
second line | ||
""" | ||
When I print it | ||
Then I should see | ||
""" | ||
first linesecond line | ||
""" |