Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Jun 19, 2023
1 parent 03b678b commit cac581e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions test/pkgs/PkgWithAmbiguities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ module PkgWithAmbiguities
f(::Any, ::Int) = 1
f(::Int, ::Any) = 2

abstract type AbstractType{T} end
struct ConcreteType{T} <: AbstractType{T} end
(::AbstractType{T})(::Tuple{Tuple{Int}}) where {T} = 1
(::ConcreteType)(::Tuple) = 2

end # module
16 changes: 13 additions & 3 deletions test/test_ambiguities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@ include("preamble.jl")
using PkgWithAmbiguities

@testset begin
@info "↓↓↓ Following failures are expected. ↓↓↓"
results = @testtestset begin
@info "↓↓↓ Following failures are expected. ↓↓↓"
Aqua.test_ambiguities(PkgWithAmbiguities)

# exclude just anything irrelevant, see #49
Aqua.test_ambiguities(PkgWithAmbiguities; exclude = [convert])

Aqua.test_ambiguities(
PkgWithAmbiguities;
exclude = [PkgWithAmbiguities.f, PkgWithAmbiguities.AbstractType],
)
@info "↑↑↑ Above failures are expected. ↑↑↑" # move above once broken test fixed
end
@info "↑↑↑ Above failures are expected. ↑↑↑"
@test length(results) == 1
@test length(results) == 3
@test results[1] isa Test.Fail
@test results[2] isa Test.Fail
@test_broken results[3] isa Test.Pass

# It works with other tests:
Aqua.test_unbound_args(PkgWithAmbiguities)
Expand Down

0 comments on commit cac581e

Please sign in to comment.