Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

put test objects in implements and test modules #37

Merged
merged 11 commits into from
Nov 3, 2023
Merged

Conversation

rafaqz
Copy link
Owner

@rafaqz rafaqz commented Nov 2, 2023

This PR moves test objects back to the @implements macro, and implements the test method for Module:

@test Interfaces.test(SomeModule)

Which cuts a huge amount of code from BaseInterfaces.jl and ensures everything implemented is tested.

Closes #35

@rafaqz rafaqz requested a review from gdalle November 2, 2023 15:58
@rafaqz rafaqz force-pushed the test_object_implements branch from f9dc2ec to 0737cc7 Compare November 2, 2023 18:10
@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2023

Codecov Report

Merging #37 (dd0f8ad) into main (8702407) will decrease coverage by 7.39%.
The diff coverage is 27.27%.

❗ Current head dd0f8ad differs from pull request most recent head 5ce4665. Consider uploading reports for the commit 5ce4665 to get more accurate results

@@            Coverage Diff             @@
##             main      #37      +/-   ##
==========================================
- Coverage   82.38%   75.00%   -7.39%     
==========================================
  Files           5        5              
  Lines         159      176      +17     
==========================================
+ Hits          131      132       +1     
- Misses         28       44      +16     
Files Coverage Δ
src/implements.jl 73.91% <100.00%> (+1.18%) ⬆️
src/interface.jl 77.77% <ø> (ø)
src/test.jl 72.51% <11.11%> (-10.09%) ⬇️

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

else
@implements IterationInterface{:indexing} NamedTuple [(a=1, b=2, c=3, d=4)] # No reverse on 1.6
end
# @implements IterationInterface{(:reverse,:indexing)} String
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with the commented ones?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They weren't actually tested before anyway 😅

Good reason for the PR in itself. Guess I should make some test data for them...

BaseInterfaces/test/runtests.jl Show resolved Hide resolved
BaseInterfaces/test/runtests.jl Show resolved Hide resolved
src/implements.jl Outdated Show resolved Hide resolved
src/implements.jl Show resolved Hide resolved
src/test.jl Show resolved Hide resolved
src/test.jl Outdated Show resolved Hide resolved
src/test.jl Outdated Show resolved Hide resolved
s = Base.IdSet(); push!(s, "a"); push!(s, "b")
@test Interfaces.test(SetInterface, Base.IdSet, [s])
end
@test_broken Interfaces.test(ArrayInterface, Base.LogicalIndex, [to_indices([1, 2, 3], ([false, true, true],))[1]])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fixable in Base Julia?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes by putting collect(LogicalIndex(I)) here

But of course that has a serious performance hit.

See: JuliaLang/julia#51071

@rafaqz rafaqz mentioned this pull request Nov 3, 2023
@rafaqz rafaqz merged commit 719fdae into main Nov 3, 2023
7 checks passed
@rafaqz rafaqz deleted the test_object_implements branch November 3, 2023 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move test objects back to the @implements macro
3 participants