diff --git a/NEWS.md b/NEWS.md index 50de482..4a30ca6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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...)` diff --git a/test/runtests.jl b/test/runtests.jl index ca2064c..9803710 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,6 +17,7 @@ Aqua.test_all(Speculator) end @test isnothing(check_all_explicit_imports_are_public(Speculator; ignore = ( + :Builtin, :IdSet, :TypeofBottom, :Typeof, @@ -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" @@ -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)