Skip to content

Commit c99a04a

Browse files
committed
Skeleton updates
1 parent 3b5f416 commit c99a04a

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ repos:
77
- id: check-yaml
88
- id: end-of-file-fixer
99
exclude_types: [markdown] # incompatible with Literate.jl
10-
- repo: https://github.com/qiaojunfeng/pre-commit-julia-format
11-
rev: v0.2.0
10+
11+
- repo: "https://github.com/domluna/JuliaFormatter.jl"
12+
rev: v1.0.62
1213
hooks:
13-
- id: julia-format
14+
- id: "julia-formatter"

test/runtests.jl

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using SafeTestsets: @safetestset
2-
using Suppressor: @suppress
2+
using Suppressor: Suppressor
33

44
# check for filtered groups
55
# either via `--group=ALL` or through ENV["GROUP"]
@@ -13,11 +13,12 @@ const GROUP = uppercase(
1313
end,
1414
)
1515

16-
function istestfile(filename)
17-
return isfile(filename) &&
18-
endswith(filename, ".jl") &&
19-
startswith(basename(filename), "test")
20-
end
16+
"match files of the form `test_*.jl`, but exclude `*setup*.jl`"
17+
istestfile(fn) =
18+
endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup")
19+
"match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`"
20+
isexamplefile(fn) =
21+
endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup")
2122

2223
@time begin
2324
# tests in groups based on folder structure
@@ -33,17 +34,28 @@ end
3334

3435
# single files in top folder
3536
for file in filter(istestfile, readdir(@__DIR__))
36-
(file == basename(@__FILE__)) && continue
37+
(file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion
3738
@eval @safetestset $file begin
3839
include($file)
3940
end
4041
end
4142

4243
# test examples
4344
examplepath = joinpath(@__DIR__, "..", "examples")
44-
for file in filter(endswith(".jl"), readdir(examplepath; join=true))
45-
@suppress @eval @safetestset $file begin
46-
include($file)
45+
for (root, _, files) in walkdir(examplepath)
46+
contains(chopprefix(root, @__DIR__), "setup") && continue
47+
for file in filter(isexamplefile, files)
48+
filename = joinpath(root, file)
49+
@eval begin
50+
@safetestset $file begin
51+
$(Expr(
52+
:macrocall,
53+
GlobalRef(Suppressor, Symbol("@suppress")),
54+
LineNumberNode(@__LINE__, @__FILE__),
55+
:(include($filename)),
56+
))
57+
end
58+
end
4759
end
4860
end
4961
end

0 commit comments

Comments
 (0)