Skip to content

Commit

Permalink
fix all the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Mar 3, 2024
1 parent d8dcbb1 commit 692b95b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion BaseInterfaces/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Test
@implements SetInterface{(:empty,:emptymutable,:hasfastin,:intersect,:union,:sizehint!)} Test.GenericSet [Test.GenericSet(Set((1, 2)))]
@implements DictInterface Test.GenericDict [Arguments(d=Test.GenericDict(Dict(:a => 1, :b => 2)), k=:c, v=3)]

@test "inheritance" begin
@testset "inheritance" begin
# Inherited interfaces are stored in the second parameter of the supertype
@test supertype(ArrayInterface) <: Interfaces.Interface{<:Any,IterationInterface{(:reverse, :indexing)}}
@test supertype(DictInterface) <: Interfaces.Interface{<:Any,IterationInterface{(:reverse,)}}
Expand Down
3 changes: 0 additions & 3 deletions src/implements.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ _user_optional_keys(::Type{<:Interface}) = ()
_all_in(items::Tuple, collection) = all(map(in(collection), items))
_all_in(item::Symbol, collection) = in(item, collection)

_as_tuple(xs::Tuple) = xs
_as_tuple(x) = (x,)

struct Implemented{T<:Interface} end
struct NotImplemented{T<:Interface} end

Expand Down
5 changes: 0 additions & 5 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,12 @@ function _flatten_inheritance(::Type{T}) where T
else
T

Check warning on line 31 in src/interface.jl

View check run for this annotation

Codecov / codecov/patch

src/interface.jl#L31

Added line #L31 was not covered by tests
end
@show T t
println()
println()
return t

Check warning on line 33 in src/interface.jl

View check run for this annotation

Codecov / codecov/patch

src/interface.jl#L33

Added line #L33 was not covered by tests
end
function _flatten_inheritance(

Check warning on line 35 in src/interface.jl

View check run for this annotation

Codecov / codecov/patch

src/interface.jl#L35

Added line #L35 was not covered by tests
::Type{T}
) where T<:Interface{Options,Inherited} where {Options,Inherited}
t = Inherited <: Nothing ? T : Union{T,Inherited}
@show T t
println()
return t

Check warning on line 39 in src/interface.jl

View check run for this annotation

Codecov / codecov/patch

src/interface.jl#L38-L39

Added lines #L38 - L39 were not covered by tests
end

Expand Down
2 changes: 1 addition & 1 deletion src/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function test(::Type{T}; show=true, kw...) where T
results = map(methodlist) do m
t = m.sig.parameters[2].var.ub
t isa UnionAll || return true
interface = t.body.name.wrapper
interface = t.body.body.name.wrapper
# If T implements it, test that
if implements(interface, T)
interface, test(interface, T; show, kw...)
Expand Down

0 comments on commit 692b95b

Please sign in to comment.