Skip to content

Commit

Permalink
Test skipping types with the predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobjpeters committed Jan 6, 2025
1 parent 430b6d4 commit 484c8be
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## v0.2.0

- Check the `predicate` while searching method parameters
- Check the `predicate` while searching method parameter types
- Stop logging during `install_speculator` and `uninstall_speculator`
- Closes [`verbosity=silent` prints installed message #4](https://github.com/jakobjpeters/Speculator.jl/issues/4)
- Implemented `symdiff(::Verbosity, ::Verbosity...)`
17 changes: 13 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Aqua.test_all(Speculator)
end

@test isnothing(check_all_explicit_imports_are_public(Speculator; ignore = (
:Builtin,
:IdSet,
:TypeofBottom,
:Typeof,
Expand Down Expand Up @@ -105,12 +106,9 @@ end
@test !Speculator.is_repl_ready()

ast_transforms = []
@test_logs (:info, "The input speculator has been installed into the REPL") begin
Speculator.install_speculator!(Returns(true), ast_transforms, false)
end
@test (Speculator.install_speculator!(Returns(true), ast_transforms, false); true)
@test only(ast_transforms) isa Speculator.InputSpeculator
@test isempty(Speculator.uninstall_speculator!(ast_transforms))

@test (uninstall_speculator(); true)

@test repr(all_modules) == "all_modules::AllModules"
Expand Down Expand Up @@ -245,6 +243,17 @@ path = tempname()
@test count_methods(Returns(false), all_modules)[1] == 0
@test count_methods(Returns(false), ::String -> nothing)[1] == 0

abstract type A end
struct B <: A end
struct C <: A end

g(::A) = nothing

@test count_methods((_, n) -> n != :A, g) == [0, 1]
@test count_methods((_, n) -> n != :B, g) == [1, 1]
@test count_methods(g) == [0, 1]
@test count_methods(g; limit = 2) == [2, 1]

# speculate(Base)
# count precompiled + skipped
# speculate(Base)
Expand Down

0 comments on commit 484c8be

Please sign in to comment.