I recently learned about using let-blocks for encapsulation.
Is there any good way to test functions within let-blocks apart from making them global?
function only_global_for_testing end
function actually_needed_in_interface end
let local_num = 5
global only_global_for_testing() = local_num * 2 # meh...
global actually_needed_in_interface() = only_global_for_testing() * 2 # ok
end
# in my testfile
# ...
@test only_global_for_testing() == 10
@test actually_needed_in_interface() == 20
# ...
Is there any standard-Julia-way of testing those local functions that I’d rather not have in my interface?
Or is the rule to go: If it is important enough to be tested on its own, it is probably important enough for the interface?