Mercurial > repos > public > sbplib_julia
view test/runtests.jl @ 717:1c5600a711ae feature/selectable_tests
Allow multiple filters
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 12 Mar 2021 19:53:40 +0100 |
parents | be648c6d6686 |
children | 95b207729b7a |
line wrap: on
line source
using Test using Glob """ run_testfiles() run_testfiles(path) run_testfiles(path, globs) Find and run all files with filenames ending with "_test.jl". If `path` is omitted the test folder is assumed. The argument `globs` can optionally be supplied to filter which test files are run. """ function run_testfiles(args) if isempty(args) globs = [fn"./*"] else globs = Glob.FilenameMatch.("./".*args) end run_testfiles(".", globs) end function run_testfiles(path, globs) for name ∈ readdir(path) filepath = joinpath(path, name) if isdir(filepath) @testset "$name" begin run_testfiles(filepath, globs) end end if endswith(name, "_test.jl") && any(occursin.(globs, filepath)) printstyled("Running "; bold=true, color=:green) println(filepath) @testset "$name" begin include(filepath) end end end end testsetname = isempty(ARGS) ? "Sbplib.jl" : join(ARGS, ", ") @testset "$testsetname" begin run_testfiles(ARGS) end