Add support for @and and @but when writing steps

This matches the Cucumber documentation.
Fixes #3
This commit is contained in:
Emmanuel Briot 2021-04-15 11:54:53 +02:00
parent 936b2e0327
commit 6e92c008e7
4 changed files with 6 additions and 5 deletions

View File

@ -41,7 +41,7 @@ could also be several features in a given file, but this is not recommended in
general (this is an extension of the format used by cucumber).
The scenario is split into several **steps**, each of which start on a separate
line. The steps are introduced by one of severaal keywords, all shown in bold
line. The steps are introduced by one of several keywords, all shown in bold
in the example above. You can use any of the keywords for any of the steps, but
in general they have the following semantic:
@ -57,7 +57,7 @@ in general they have the following semantic:
* **Then** observes the outcome of the actions. These observations should be
related to the business benefit that was described in the feature. The
observation should be on some kind of output that is something that comes out
of the system (report, user interface, message,...) and preferrably not
of the system (report, user interface, message,...) and preferably not
something deeply buried in the system (use unit tests for those instead).
The example above indents each level of the description. This is not

View File

@ -154,7 +154,8 @@ The comment must occur just before the subprogram to which it applies.
With comments, how do we handle cases where the regexp is too long
to fix on a line, except for using pragma Style_Checks(Off).
The comments should start with one of '@given', '@then' or '@when'.
The comments should start with one of '@given', '@then', '@and', '@but'
or '@when'.
There is no semantic difference, they only act as a way to help
introduce the regexp.

View File

@ -9,7 +9,7 @@ package MySteps1 is
-- @then ^I should read %integer$
procedure Then_I_Should_Read (Result : Integer);
-- @then ^the stack should contain$
-- @and ^the stack should contain$
procedure Then_The_Stack_Should_Contain (Expected : BDD.Tables.Table);
end MySteps1;

View File

@ -49,7 +49,7 @@ package body Gnatbdd.Codegen is
Compile ("^package ([_\.\w]+)", Case_Insensitive or Multiple_Lines);
Cst_Comment_Re : constant Pattern_Matcher :=
Compile ("--\s*@(given|then|when)\s+");
Compile ("--\s*@(given|then|when|and|but)\s+");
-- Matches the special comments before step definitions
Cst_Setup_Re : constant Pattern_Matcher :=