@@ -7,39 +7,42 @@ const pat = r"(?:--group=)(\w+)"
77arg_id = findfirst (contains (pat), ARGS )
88const GROUP = uppercase (
99 if isnothing (arg_id)
10- get (ENV , " GROUP" , " ALL" )
10+ arg = get (ENV , " GROUP" , " ALL" )
11+ # For some reason `ENV["GROUP"]` is set to `""`
12+ # when running via GitHub Actions, so handle that case:
13+ arg == " " ? " ALL" : arg
1114 else
1215 only (match (pat, ARGS [arg_id]). captures)
1316 end ,
1417)
1518
1619" match files of the form `test_*.jl`, but exclude `*setup*.jl`"
17- function istestfile (fn)
20+ function istestfile (path)
21+ fn = basename (path)
1822 return endswith (fn, " .jl" ) && startswith (basename (fn), " test_" ) && ! contains (fn, " setup" )
1923end
2024" match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`"
21- function isexamplefile (fn)
25+ function isexamplefile (path)
26+ fn = basename (path)
2227 return endswith (fn, " .jl" ) && ! endswith (fn, " _notest.jl" ) && ! contains (fn, " setup" )
2328end
2429
2530@time begin
2631 # tests in groups based on folder structure
27- for testgroup in filter (f -> isdir (joinpath (@__DIR__ , f)), readdir (@__DIR__ ))
28- if GROUP == " ALL" || GROUP == uppercase (testgroup)
29- groupdir = joinpath (@__DIR__ , testgroup)
30- for file in filter (istestfile, readdir (groupdir))
31- filename = joinpath (groupdir, file)
32- @eval @safetestset $ file begin
32+ for testgroup in filter (isdir, readdir (@__DIR__ ; join = true ))
33+ if GROUP == " ALL" || GROUP == uppercase (basename (testgroup))
34+ for filename in filter (istestfile, readdir (testgroup; join = true ))
35+ @eval @safetestset $ (basename (filename)) begin
3336 include ($ filename)
3437 end
3538 end
3639 end
3740 end
3841
3942 # single files in top folder
40- for file in filter (istestfile, readdir (@__DIR__ ))
41- (file == basename (@__FILE__ )) && continue # exclude this file to avoid infinite recursion
42- @eval @safetestset $ file begin
43+ for file in filter (istestfile, readdir (@__DIR__ ; join = true ))
44+ (basename ( file) == basename (@__FILE__ )) && continue # exclude this file to avoid infinite recursion
45+ @eval @safetestset $ ( basename ( file)) begin
4346 include ($ file)
4447 end
4548 end
0 commit comments