Open Lucretia opened 3 years ago
-- @then ^lines (\d+)-(\d+) of ppm are$ procedure Test (Start_Line, End_Line : Positive; Str : String);
Shouldn’t you tell the regexp that you expect a string ?
-- @then ^lines (\d+)-(\d+) of ppm are (.+)$
I don't know, your documentation doesn't say.
That regexp doesn't match it, neither does:
-- @then ^lines (\d+)-(\d+) of ppm are(.+)$
-- @then ^lines (\d+)-(\d+) of ppm are (.*)$
But this does:
-- @then ^lines (\d+)-(\d+) of ppm are(.*)$
But that doesn't give me a string, my Test function prints it:
procedure Test (Start_Line, End_Line : Positive; Str : String) is
begin
put_line("Str: " & Str);
end Test;
Results:
gen/debug/.obj/rt_bdd --features=../../src/features/
..Str:
.............................
-- @then ^lines (\d+)-(\d+) of ppm are(.*)$
That will match and empty string at the end indeed. which what you are getting.
Had a quick look at the code, seems like multi-strings are not supported in the code generator (though supported in the parser somewhat)
I changed gnatbdd-codegen.adb:484
to
Append (Data.Regexps,
" Re_"
& Image (Data.Steps_Count, Min_Width => 0)
& " : constant Pattern_Matcher := Compile" & ASCII.LF
& " (""" & Escape (Regexp) & """, Multiple_Lines);" & ASCII.LF);
I can get it to pass, but I'm getting nothing passed to the Str parameter.
Given the following scenario:
With a regexp of:
Fails to generate with the following error:
Remove the String parameter and it generates, but incorrectly. The multiline string is parsed by gnatbdd, but not passed as an extra parameter at the end of the function.