@allocated
tends to report some allocations even if there actually are none in the function. You can try running the function multiple times to overcome this: @test @allocated(for _ in 1:1000 f(x) end) < 100
.
More package examples:
- Accessors.jl use BenchmarkTools Accessors.jl/perf.jl at master · JuliaObjects/Accessors.jl · GitHub
- ConstructionBase.jl does something more fancy ConstructionBase.jl/runtests.jl at master · JuliaObjects/ConstructionBase.jl · GitHub