diff --git a/lib/test.gi b/lib/test.gi index f16b3922fa..2f4317933d 100644 --- a/lib/test.gi +++ b/lib/test.gi @@ -93,8 +93,9 @@ InstallGlobalFunction(ParseTestInput, function(str, ignorecomments, fnam) i := i+1; else Add(inp, "\n"); + Add(pos, i); i := i+1; - while i <= Length(lines) and (Length(lines[i]) = 0 or lines[i][1] = '#') do + while i <= Length(lines) and (Length(lines[i]) = 0 or (StartsWith(lines[i], "#") and not StartsWith(lines[i], "#@"))) do i := i+1; od; Add(outp, JoinStringsWithSeparator(lines{[1..i-1]}, "\n")); diff --git a/tst/testspecial/broken-test.g.out b/tst/testspecial/broken-test.g.out index 6ac311a482..60fcd3d493 100644 --- a/tst/testspecial/broken-test.g.out +++ b/tst/testspecial/broken-test.g.out @@ -1,15 +1,15 @@ gap> Test("broken-test-2.tst", rec(width := 800)); Error, Invalid test file: #@ command found in the middle of a single test at broken-test-2.tst:5 at GAPROOT/lib/test.gi:31 called from -testError( "Invalid test file: #@ command found in the middle of a single test" ); at GAPROOT/lib/test.gi:131 called from -ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:571 called from +testError( "Invalid test file: #@ command found in the middle of a single test" ); at GAPROOT/lib/test.gi:132 called from +ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:572 called from ( ) called from read-eval loop at *stdin*:2 type 'quit;' to quit to outer loop brk> quit; gap> Test("broken-test-3.tst", rec(width := 800)); Error, Invalid test file at broken-test-3.tst:5 at GAPROOT/lib/test.gi:31 called from -testError( "Invalid test file" ); at GAPROOT/lib/test.gi:137 called from -ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:571 called from +testError( "Invalid test file" ); at GAPROOT/lib/test.gi:138 called from +ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:572 called from ( ) called from read-eval loop at *stdin*:2 type 'quit;' to quit to outer loop @@ -17,7 +17,7 @@ brk> quit; gap> Test("broken-test-4.tst", rec(width := 800)); Error, Invalid test file: Nested #@if at broken-test-4.tst:2 at GAPROOT/lib/test.gi:31 called from testError( "Invalid test file: Nested #@if" ); at GAPROOT/lib/test.gi:52 called from -ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:571 called from +ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:572 called from ( ) called from read-eval loop at *stdin*:2 type 'quit;' to quit to outer loop @@ -25,23 +25,23 @@ brk> quit; gap> Test("broken-test-5.tst", rec(width := 800)); Error, Invalid test file: two #@else at broken-test-5.tst:7 at GAPROOT/lib/test.gi:31 called from testError( "Invalid test file: two #@else" ); at GAPROOT/lib/test.gi:63 called from -ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:571 called from +ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:572 called from ( ) called from read-eval loop at *stdin*:2 type 'quit;' to quit to outer loop brk> quit; gap> Test("broken-test-6.tst", rec(width := 800)); Error, Invalid test file: Continuation prompt '> ' followed by a tab, expected a regular space at broken-test-6.tst:3 at GAPROOT/lib/test.gi:31 called from -testError( "Invalid test file: Continuation prompt '> ' followed by a tab, expected a regular space" ); at GAPROOT/lib/test.gi:128 called from -ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:571 called from +testError( "Invalid test file: Continuation prompt '> ' followed by a tab, expected a regular space" ); at GAPROOT/lib/test.gi:129 called from +ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:572 called from ( ) called from read-eval loop at *stdin*:2 type 'quit;' to quit to outer loop brk> quit; gap> Test("invalidtestfile.tst", rec(width := 800)); Error, Invalid test file at invalidtestfile.tst:7 at GAPROOT/lib/test.gi:31 called from -testError( "Invalid test file" ); at GAPROOT/lib/test.gi:137 called from -ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:571 called from +testError( "Invalid test file" ); at GAPROOT/lib/test.gi:138 called from +ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:572 called from ( ) called from read-eval loop at *stdin*:2 type 'quit;' to quit to outer loop diff --git a/tst/testspecial/leading-empty-line.g b/tst/testspecial/leading-empty-line.g new file mode 100644 index 0000000000..49b7109545 --- /dev/null +++ b/tst/testspecial/leading-empty-line.g @@ -0,0 +1 @@ +Test("leading-empty-line.tst", rec(width := 800, ignoreComments := false)); diff --git a/tst/testspecial/leading-empty-line.g.out b/tst/testspecial/leading-empty-line.g.out new file mode 100644 index 0000000000..58d9da3ae8 --- /dev/null +++ b/tst/testspecial/leading-empty-line.g.out @@ -0,0 +1,10 @@ +gap> Test("leading-empty-line.tst", rec(width := 800, ignoreComments := false)); +########> Diff in leading-empty-line.tst:1 +# Input is: + +# Expected output: + +# But found: +######## +false +gap> QUIT; diff --git a/tst/testspecial/leading-empty-line.tst b/tst/testspecial/leading-empty-line.tst new file mode 100644 index 0000000000..286fcd56ed --- /dev/null +++ b/tst/testspecial/leading-empty-line.tst @@ -0,0 +1,5 @@ + +#@if true +gap> 1 + 1; +2 +#@fi