Skip to content

Commit

Permalink
Add warning a file given to Test contains no tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJefferson authored and markuspf committed Jun 7, 2018
1 parent 544e716 commit 758a719
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/test.gi
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,11 @@ InstallGlobalFunction("Test", function(arg)

# split input into GAP input, GAP output and comments
pf := ParseTestInput(full, opts.ignoreComments);

# Warn if we have not found any tests in the file
if IsEmpty(pf[1]) then
Info(InfoWarning, 1, "Test: File does not contain any tests!");
fi;

# run the GAP inputs and collect the outputs and the timings
RunTests(pf, rec(breakOnError := opts.breakOnError,
Expand Down
8 changes: 8 additions & 0 deletions tst/testinstall/files/invalidtestfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file contains some valid GAP code which is not
# a valid tst file, to check error reporting.
#
# It has a ".txt" extension to avoid it being found by
# Any code which looks through testinstall for .g or .tst files

x := 3;
g := SymmetricGroup(5);
10 changes: 10 additions & 0 deletions tst/testinstall/files/test.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
gap> START_TEST("test.tst");
gap> dir := DirectoriesLibrary("tst/testinstall/files");;
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
gap> Test(Filename(dir, "tinytest.txt"));
true
gap> STOP_TEST("test.tst");
1 change: 1 addition & 0 deletions tst/testinstall/files/tinytest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gap> 1;;

0 comments on commit 758a719

Please sign in to comment.