mirror of https://github.com/briot/gnatbdd
Display multi-line arguments when displaying steps
This commit is contained in:
parent
dfdeb59b89
commit
2bc5926b78
|
@ -65,7 +65,7 @@ with the first general layout for a file::
|
|||
|
||||
There could be several **scenarios** within the **feature**. In fact, there
|
||||
could also be several features in a given file, but this is not recommended in
|
||||
general.
|
||||
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
|
||||
|
|
|
@ -261,9 +261,6 @@ package body BDD.Formatters is
|
|||
Put_And_Align (Scenario, Step_Indent & Step.Text);
|
||||
|
||||
if Self.Term.Has_Colors then
|
||||
Self.Term.Set_Color
|
||||
(Term => Ada.Text_IO.Standard_Output,
|
||||
Style => Reset_All);
|
||||
Display_Location (Self, Scenario, Step);
|
||||
else
|
||||
case Step.Status is
|
||||
|
@ -277,6 +274,36 @@ package body BDD.Formatters is
|
|||
Display_Location (Self, Scenario, Step, "[SKIPPED] ");
|
||||
end case;
|
||||
end if;
|
||||
|
||||
declare
|
||||
Multi : constant String := Step.Multiline;
|
||||
Start, Last : Integer;
|
||||
begin
|
||||
if Multi /= "" then
|
||||
Self.Term.Set_Color
|
||||
(Term => Ada.Text_IO.Standard_Output,
|
||||
Foreground => BDD.Step_Colors (Step.Status));
|
||||
Put_Line (" """"""");
|
||||
|
||||
Start := Multi'First;
|
||||
while Start <= Multi'Last loop
|
||||
Last := Line_End (Multi, Start);
|
||||
if Last < Start then -- empty line
|
||||
New_Line;
|
||||
Start := Last + 2;
|
||||
else
|
||||
Put (" " & Multi (Start .. Last));
|
||||
Start := Last + 1;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
Put_Line (" """"""");
|
||||
end if;
|
||||
end;
|
||||
|
||||
Self.Term.Set_Color
|
||||
(Term => Ada.Text_IO.Standard_Output,
|
||||
Style => Reset_All);
|
||||
end Display_Step;
|
||||
|
||||
----------------------------
|
||||
|
|
|
@ -137,7 +137,7 @@ package body BDD.Parser is
|
|||
State := In_Scenario;
|
||||
elsif Step /= null then
|
||||
State := In_String;
|
||||
String_Indent := First_Char - Line_S;
|
||||
String_Indent := First_Char - Line_S + 1;
|
||||
String_Line_Start := Line;
|
||||
else
|
||||
raise Syntax_Error with "Multi-line strings only allowed in"
|
||||
|
|
Loading…
Reference in New Issue