Display multi-line arguments when displaying steps

This commit is contained in:
Emmanuel Briot 2014-02-07 15:54:00 +01:00
parent dfdeb59b89
commit 2bc5926b78
3 changed files with 32 additions and 5 deletions

View File

@ -65,7 +65,7 @@ with the first general layout for a file::
There could be several **scenarios** within the **feature**. In fact, there 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 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 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 severaal keywords, all shown in bold

View File

@ -261,9 +261,6 @@ package body BDD.Formatters is
Put_And_Align (Scenario, Step_Indent & Step.Text); Put_And_Align (Scenario, Step_Indent & Step.Text);
if Self.Term.Has_Colors then if Self.Term.Has_Colors then
Self.Term.Set_Color
(Term => Ada.Text_IO.Standard_Output,
Style => Reset_All);
Display_Location (Self, Scenario, Step); Display_Location (Self, Scenario, Step);
else else
case Step.Status is case Step.Status is
@ -277,6 +274,36 @@ package body BDD.Formatters is
Display_Location (Self, Scenario, Step, "[SKIPPED] "); Display_Location (Self, Scenario, Step, "[SKIPPED] ");
end case; end case;
end if; 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; end Display_Step;
---------------------------- ----------------------------

View File

@ -137,7 +137,7 @@ package body BDD.Parser is
State := In_Scenario; State := In_Scenario;
elsif Step /= null then elsif Step /= null then
State := In_String; State := In_String;
String_Indent := First_Char - Line_S; String_Indent := First_Char - Line_S + 1;
String_Line_Start := Line; String_Line_Start := Line;
else else
raise Syntax_Error with "Multi-line strings only allowed in" raise Syntax_Error with "Multi-line strings only allowed in"