Mercurial > repos > public > sbplib_julia
comparison test/runtests.jl @ 769:0158c3fd521c operator_storage_array_of_table
Merge in default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 15 Jul 2021 00:06:16 +0200 |
parents | e279c53eb647 |
children | f88b2117dc69 e7176fb09e98 |
comparison
equal
deleted
inserted
replaced
768:7c87a33963c5 | 769:0158c3fd521c |
---|---|
1 using Test | 1 using Test |
2 using TestSetExtensions | 2 using Glob |
3 | 3 |
4 @testset "All" begin | 4 """ |
5 @includetests ARGS | 5 run_testfiles() |
6 run_testfiles(path, globs) | |
7 | |
8 Find and run all files with filenames ending with "_test.jl". If `path` is omitted the test folder is assumed. | |
9 The argument `globs` can optionally be supplied to filter which test files are run. | |
10 """ | |
11 function run_testfiles(args) | |
12 if isempty(args) | |
13 globs = [fn"./*"] | |
14 else | |
15 globs = Glob.FilenameMatch.("./".*args) | |
16 end | |
17 | |
18 run_testfiles(".", globs) | |
6 end | 19 end |
20 | |
21 function run_testfiles(path, globs) | |
22 for name ∈ readdir(path) | |
23 filepath = joinpath(path, name) | |
24 | |
25 if isdir(filepath) | |
26 @testset "$name" begin | |
27 run_testfiles(filepath, globs) | |
28 end | |
29 end | |
30 | |
31 if endswith(name, "_test.jl") && any(occursin.(globs, filepath)) | |
32 printstyled("Running "; bold=true, color=:green) | |
33 print(filepath) | |
34 | |
35 t_start = time() | |
36 @testset "$name" begin | |
37 include(filepath) | |
38 end | |
39 t_end = time() | |
40 | |
41 Δt = t_end - t_start | |
42 printstyled(" ($(round(Δt, digits=2)) s)"; color=:light_black) | |
43 println() | |
44 end | |
45 end | |
46 end | |
47 | |
48 testsetname = isempty(ARGS) ? "Sbplib.jl" : "["*join(ARGS, ", ")*"]" | |
49 | |
50 @testset "$testsetname" begin | |
51 run_testfiles(ARGS) | |
52 end |