Mercurial > repos > public > sbplib_julia
view test/runtests.jl @ 711:df88aee35bb9 feature/selectable_tests
Switch to _test.jl suffix
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 20 Feb 2021 20:45:40 +0100 |
parents | 48a61e085e60 |
children | be648c6d6686 |
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) include(filepath) end end end testsetname = isempty(ARGS) ? "Sbplib.jl" : ARGS[1] @testset "$testsetname" begin run_testfiles(ARGS) end