Mercurial > repos > public > sbplib_julia
view test/runtests.jl @ 714:11a444d6fc93 feature/selectable_tests
Remove module wrapping testsets. They are now automatically added through the folders
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 20 Feb 2021 21:15:52 +0100 |
parents | be648c6d6686 |
children | 1c5600a711ae |
line wrap: on
line source
using Test using Glob """ run_testfiles() run_testfiles(path) run_testfiles(path, glob) Find and run all files with filenames ending with "_test.jl". If `path` is omitted the test folder is assumed. The argument `glob` can optionally be supplied to filter which test files are run. """ function run_testfiles(args) if isempty(args) glob = fn"./*" else glob = Glob.FilenameMatch("./"*args[1]) #TBD: Allow multiple filters? end run_testfiles(".", glob) end function run_testfiles(path, glob) for name ∈ readdir(path) filepath = joinpath(path, name) if isdir(filepath) @testset "$name" begin run_testfiles(filepath, glob) end end if endswith(name, "_test.jl") && occursin(glob, filepath) printstyled("Running "; bold=true, color=:green) println(filepath) @testset "$name" begin include(filepath) end end end end testsetname = isempty(ARGS) ? "Sbplib.jl" : ARGS[1] @testset "$testsetname" begin run_testfiles(ARGS) end