Mercurial > repos > public > sbplib_julia
view test/runtests.jl @ 728:45966c77cb20 feature/selectable_tests
Split tests for SbpOperators over several files
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 17 Mar 2021 20:34:40 +0100 |
parents | 95b207729b7a |
children | 1ea81e106482 |
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 # Make it more clear that a glob was used in the test set name. # Make standalone files fail the same way when run together and alone # Add a timer for each file run