Is it possible to add reliable tests that functions do not allocate?

@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: