Suppressor.jl icon indicating copy to clipboard operation
Suppressor.jl copied to clipboard

Mock jl_generating_output as true in tests.

Open Ismael-VC opened this issue 7 years ago • 1 comments

Ismael-VC avatar Feb 27 '18 01:02 Ismael-VC

This seems like a good idea and should help boost test coverage.

It does change behavior a little though, as _jl_generating_output() will get called at macro expansion time rather than checking as part of the generated code. for instance, if I have

function foo()
    @suppress_out println("hello")
end

then _jl_generating_output() will get called when foo is compiled and replaced with a static true or false.

I'm not 100% sure under what conditions ccall(:jl_generating_output, Cint, ()) returns 0 or 1 so I don't know if this is a problem in practice, but it seems like it should check each time foo is called.

I think what we'd want is something more like !($(_jl_generating_output)()), or maybe !Suppressor._jl_generating_output()

ssfrr avatar Jul 03 '18 16:07 ssfrr