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 committed Jun 7, 2018
1 parent 24e68b7 commit 8c33925
Show file tree
Hide file tree
Showing 4 changed files with 25 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 @@ -418,6 +418,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);
11 changes: 11 additions & 0 deletions tst/testinstall/files/test.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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"));
#I Test: File does not contain any tests!
true
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 8c33925

Please sign in to comment.