@@ -6,60 +6,62 @@ using Suppressor: Suppressor
66const pat = r" (?:--group=)(\w +)"
77arg_id = findfirst (contains (pat), ARGS )
88const GROUP = uppercase (
9- if isnothing (arg_id)
10- get (ENV , " GROUP" , " ALL" )
11- else
12- only (match (pat, ARGS [arg_id]). captures)
13- end ,
9+ if isnothing (arg_id)
10+ get (ENV , " GROUP" , " ALL" )
11+ else
12+ only (match (pat, ARGS [arg_id]). captures)
13+ end ,
1414)
1515
1616" match files of the form `test_*.jl`, but exclude `*setup*.jl`"
1717function istestfile (fn)
18- return endswith (fn, " .jl" ) && startswith (basename (fn), " test_" ) && ! contains (fn, " setup" )
18+ return endswith (fn, " .jl" ) && startswith (basename (fn), " test_" ) && ! contains (fn, " setup" )
1919end
2020" match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`"
2121function isexamplefile (fn)
22- return endswith (fn, " .jl" ) && ! endswith (fn, " _notest.jl" ) && ! contains (fn, " setup" )
22+ return endswith (fn, " .jl" ) && ! endswith (fn, " _notest.jl" ) && ! contains (fn, " setup" )
2323end
2424
2525@time begin
26- # tests in groups based on folder structure
27- for testgroup in filter (isdir, 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
33- include ($ filename)
26+ # tests in groups based on folder structure
27+ for testgroup in filter (isdir, 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
33+ include ($ filename)
34+ end
35+ end
3436 end
35- end
3637 end
37- end
3838
39- # 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- include ($ file)
39+ # 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+ include ($ file)
44+ end
4445 end
45- end
4646
47- # test examples
48- examplepath = joinpath (@__DIR__ , " .." , " examples" )
49- for (root, _, files) in walkdir (examplepath)
50- contains (chopprefix (root, @__DIR__ ), " setup" ) && continue
51- for file in filter (isexamplefile, files)
52- filename = joinpath (root, file)
53- @eval begin
54- @safetestset $ file begin
55- $ (Expr (
56- :macrocall ,
57- GlobalRef (Suppressor, Symbol (" @suppress" )),
58- LineNumberNode (@__LINE__ , @__FILE__ ),
59- :(include ($ filename)),
60- ))
47+ # test examples
48+ examplepath = joinpath (@__DIR__ , " .." , " examples" )
49+ for (root, _, files) in walkdir (examplepath)
50+ contains (chopprefix (root, @__DIR__ ), " setup" ) && continue
51+ for file in filter (isexamplefile, files)
52+ filename = joinpath (root, file)
53+ @eval begin
54+ @safetestset $ file begin
55+ $ (
56+ Expr (
57+ :macrocall ,
58+ GlobalRef (Suppressor, Symbol (" @suppress" )),
59+ LineNumberNode (@__LINE__ , @__FILE__ ),
60+ :(include ($ filename)),
61+ )
62+ )
63+ end
64+ end
6165 end
62- end
6366 end
64- end
6567end
0 commit comments