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

Allow input and output to be mixed in Test #3168

Merged
merged 1 commit into from
Jan 10, 2019
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
3 changes: 0 additions & 3 deletions lib/test.gi
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ InstallGlobalFunction(ParseTestInput, function(str, ignorecomments, fnam)
Add(pos, i);
i := i+1;
elif Length(lines[i]) > 1 and lines[i]{[1..2]} = "> " then
if Length(outp) > 0 and Length(outp[Length(outp)]) > 0 then
testError("Invalid test file: '> ' continuation found in the middle of a test output");
fi;
if foundcmd then
testError("Invalid test file: #@ command found in the middle of a single test");
fi;
Expand Down
34 changes: 34 additions & 0 deletions tst/testinstall/testing.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Some very basic tests of GAP's Test function
gap> START_TEST("testing.tst");
gap> Print("cheese\n"); Print("bacon"); Print("egg\n");
cheese
baconegg
gap> 2;
2
gap> x := 4;
4
gap> x;
4

#
# Statements where input + output are mixed
# Checks test can handle output directly cut+pasted from GAP's output
#
gap> x :=
> 2;
2
gap> x :=
> 2; y :=
2
> 3;
3
gap> if x = 2 then
> Print("pass\n");
pass
> else
> Print("fail\n");
> fi;

#
#
gap> STOP_TEST("testing.tst", 1);
3 changes: 0 additions & 3 deletions tst/testspecial/broken-test-1.tst

This file was deleted.

2 changes: 0 additions & 2 deletions tst/testspecial/broken-test.g
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Test("broken-test-1.tst", rec(width := 800));
quit;
Test("broken-test-2.tst", rec(width := 800));
quit;
Test("broken-test-3.tst", rec(width := 800));
Expand Down
24 changes: 8 additions & 16 deletions tst/testspecial/broken-test.g.out
Original file line number Diff line number Diff line change
@@ -1,47 +1,39 @@
gap> Test("broken-test-1.tst", rec(width := 800));
Error, Invalid test file: '> ' continuation found in the middle of a test output at broken-test-1.tst:3 at GAPROOT/lib/test.gi:31 called from
testError( "Invalid test file: '> ' continuation found in the middle of a test output" ); at GAPROOT/lib/test.gi:122 called from
ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:566 called from
<function "Test">( <arguments> )
called from read-eval loop at *stdin*:2
type 'quit;' to quit to outer loop
brk> quit;
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:132 called from
ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:566 called from
testError( "Invalid test file: #@ command found in the middle of a single test" ); at GAPROOT/lib/test.gi:129 called from
ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:563 called from
<function "Test">( <arguments> )
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:138 called from
ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:566 called from
testError( "Invalid test file" ); at GAPROOT/lib/test.gi:135 called from
ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:563 called from
<function "Test">( <arguments> )
called from read-eval loop at *stdin*:2
type 'quit;' to quit to outer loop
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:566 called from
ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:563 called from
<function "Test">( <arguments> )
called from read-eval loop at *stdin*:2
type 'quit;' to quit to outer loop
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:566 called from
ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:563 called from
<function "Test">( <arguments> )
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:138 called from
ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:566 called from
testError( "Invalid test file" ); at GAPROOT/lib/test.gi:135 called from
ParseTestInput( full, opts.ignoreComments, fnam ) at GAPROOT/lib/test.gi:563 called from
<function "Test">( <arguments> )
called from read-eval loop at *stdin*:2
type 'quit;' to quit to outer loop
Expand Down