Skip to content

Commit 5639465

Browse files
Add Aqua tests
1 parent d300209 commit 5639465

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ StaticArrays = "1.5"
3535
julia = "1.6"
3636

3737
[extras]
38+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
3839
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
3940
DiffTests = "de460e47-3fe3-5279-bb4a-814414816d5d"
4041
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
@@ -43,4 +44,4 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
4344
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4445

4546
[targets]
46-
test = ["Calculus", "DiffTests", "SparseArrays", "StaticArrays", "Test", "InteractiveUtils"]
47+
test = ["Aqua", "Calculus", "DiffTests", "SparseArrays", "StaticArrays", "Test", "InteractiveUtils"]

test/AquaTest.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Test
2+
using ForwardDiff
3+
using Aqua
4+
5+
@testset "Aqua tests (performance)" begin
6+
# This tests that we don't accidentally run into
7+
# https://github.com/JuliaLang/julia/issues/29393
8+
ua = Aqua.detect_unbound_args_recursively(ForwardDiff)
9+
@test length(ua) == 6
10+
11+
# See: https://github.com/SciML/OrdinaryDiffEq.jl/issues/1750
12+
# Test that we're not introducing method ambiguities across deps
13+
ambs = Aqua.detect_ambiguities(ForwardDiff; recursive = true)
14+
pkg_match(pkgname, pkdir::Nothing) = false
15+
pkg_match(pkgname, pkdir::AbstractString) = occursin(pkgname, pkdir)
16+
filter!(x -> pkg_match("ForwardDiff", pkgdir(last(x).module)), ambs)
17+
18+
@test length(ambs) == 0
19+
end
20+
21+
@testset "Aqua tests (additional)" begin
22+
Aqua.test_undefined_exports(ForwardDiff)
23+
Aqua.test_stale_deps(ForwardDiff)
24+
Aqua.test_deps_compat(ForwardDiff)
25+
Aqua.test_project_extras(ForwardDiff)
26+
Aqua.test_project_toml_formatting(ForwardDiff)
27+
Aqua.test_piracy(ForwardDiff)
28+
end
29+
30+
nothing

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,10 @@ Random.seed!(SEED)
5151
t = @elapsed include("AllocationsTest.jl")
5252
println("##### done (took $t seconds).")
5353
end
54+
@testset "Aqua" begin
55+
println("##### Testing aqua...")
56+
t = @elapsed include("AquaTest.jl")
57+
println("##### done (took $t seconds).")
58+
end
5459
println("##### Running all ForwardDiff tests took $(time() - t0) seconds.")
5560
end

0 commit comments

Comments
 (0)