Skip to content

Commit 2e7fac4

Browse files
Add warning a file given to Test contains no tests
1 parent 07f5dce commit 2e7fac4

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

lib/test.gi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,11 @@ InstallGlobalFunction("Test", function(arg)
419419

420420
# split input into GAP input, GAP output and comments
421421
pf := ParseTestInput(full, opts.ignoreComments);
422+
423+
# Warn if we have not found any tests in the file
424+
if IsEmpty(pf[1]) then
425+
Info(InfoWarning, 1, "Test: File does not contain any tests!");
426+
fi;
422427

423428
# run the GAP inputs and collect the outputs and the timings
424429
RunTests(pf, rec(breakOnError := opts.breakOnError,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file contains some valid GAP code which is not
2+
# a valid tst file, to check error reporting.
3+
#
4+
# It has a ".txt" extension to avoid it being found by
5+
# Any code which looks through testinstall for .g or .tst files
6+
7+
x := 3;
8+
g := SymmetricGroup(5);

tst/testinstall/files/test.tst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
gap> START_TEST("test.tst");
2+
gap> dir := DirectoriesLibrary("tst/testinstall/files");;
3+
gap> Test(Filename(dir,"empty.txt"));
4+
#I Test: File does not contain any tests!
5+
true
6+
gap> Test(Filename(dir,"invalidtestfile.txt"));
7+
#I Test: File does not contain any tests!
8+
true
9+
gap> Test(Filename(dir, "tinytest.txt"));
10+
true
11+
gap> STOP_TEST("test.tst");

tst/testinstall/files/tinytest.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gap> 1;;

0 commit comments

Comments
 (0)