diff --git a/lib/test.gi b/lib/test.gi index 84ce8c2aa9c..b9a9eeb5968 100644 --- a/lib/test.gi +++ b/lib/test.gi @@ -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, diff --git a/tst/testinstall/files/invalidtestfile.txt b/tst/testinstall/files/invalidtestfile.txt new file mode 100644 index 00000000000..77aa7997a1b --- /dev/null +++ b/tst/testinstall/files/invalidtestfile.txt @@ -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); \ No newline at end of file diff --git a/tst/testinstall/files/test.tst b/tst/testinstall/files/test.tst new file mode 100644 index 00000000000..dcd24e3c6e4 --- /dev/null +++ b/tst/testinstall/files/test.tst @@ -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"); diff --git a/tst/testinstall/files/tinytest.txt b/tst/testinstall/files/tinytest.txt new file mode 100644 index 00000000000..ba8083c5827 --- /dev/null +++ b/tst/testinstall/files/tinytest.txt @@ -0,0 +1 @@ +gap> 1;;