-
Notifications
You must be signed in to change notification settings - Fork 5
Description
One thing which I have found missing is the ability to define a function that tests a bunch of functionality and adds this to the current test set. I.e., something like:
function test_myfunction(inputs)
outputs = myfunction(inputs)
@test some_properties(outputs)
@constinferred myfunction(inputs)
endThis is especially useful when testing the same function on a bunch of different input types, but unfortunately this currently doesn't work:
julia> function test_myfunction(inputs)
outputs = myfunction(inputs)
@test some_properties(outputs)
@constinferred myfunction(inputs)
end
ERROR: syntax: World age increment not at top levelIn all honesty, I've looked a bit at the code and I can't say I can come up with a solution strategy.
From what I can tell, defining the function that captures the "const" arguments in a non-toplevel scope is the hard part, which I'm actually okay with skipping for now. In this specific context, I actually would really want @inferred that uses @test instead of throwing an error.
One solution strategy might be to just define an @test_inferred in this package which is more or less a copy from the Test version and replaces the error with a test?