Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Error improvements #2531

Merged
merged 2 commits into from
Jun 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions lib/test.gi
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ InstallGlobalFunction(ParseTestInput, function(str, ignorecomments)
ign := [];
i := 1;
while i <= Length(lines) do
if i = 1 and Length(lines[1]) > 0 and lines[1][1] = '#' then
if i = 1 and (Length(lines[1]) = 0 or lines[1][1] = '#') then
if ignorecomments = true then
# ignore comment lines at beginning of file
while i <= Length(lines) and Length(lines[i]) > 0 and
lines[i][1] = '#' do
# ignore comment lines and empty lines at beginning of file
while i <= Length(lines) and (Length(lines[i]) = 0 or lines[i][1] = '#')
do
Add(ign, i);
i := i+1;
od;
else
Add(inp, "\n");
i := 2;
while i <= Length(lines) and Length(lines[i]) > 0 and
lines[i][1] = '#' do
while i <= Length(lines) and (Length(lines[i]) = 0 or lines[i][1] = '#') do
i := i+1;
od;
Add(outp, JoinStringsWithSeparator(lines{[1..i-1]}, "\n"));
Expand Down Expand Up @@ -63,7 +62,7 @@ InstallGlobalFunction(ParseTestInput, function(str, ignorecomments)
Add(outp[Length(outp)], '\n');
i := i+1;
else
Error("Invalid data in test file");
Error("Invalid data at line ", i, " of test file");
i := i+1;
fi;
od;
Expand Down Expand Up @@ -191,8 +190,8 @@ end;
## continued over several lines. <Br/>
## To allow for comments in <Arg>fname</Arg> the following lines are ignored
## by default: lines at the beginning of <Arg>fname</Arg> that start with
## <C>"#"</C>, and one empty line together with one or more lines starting
## with <C>"#"</C>.<Br/>
## <C>"#"</C> or are empty, and one empty line together with one or more
## lines starting with <C>"#"</C>.<Br/>
## All other lines are considered as &GAP; output from the
## preceding &GAP; input.
## <P/>
Expand Down
2 changes: 1 addition & 1 deletion tst/testinstall/files/test.tst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gap> Test(Filename(dir,"empty.txt"));
#I Test: File does not contain any tests!
true
gap> Test(Filename(dir,"invalidtestfile.txt"));
Error, Invalid data in test file
Error, Invalid data at line 7 of test file
gap> Test(Filename(dir, "tinytest.txt"));
true
gap> STOP_TEST("test.tst");