Is there any way to test a nested function (ideally skalest)?
For example, I think the test code If the test is Any other idea has to call g () is a way of testing in the code given below:
def f () = {def G () = "a string!" G () + "A" A "G" says}}
G
F is not visible outside, so I do not have any courage, at least not without reflection
G will break the concept of unit testing, anyway, because you should not test the implementation details, but only when testing for public API behavior
f fails
< Tracking an error in / code> is part of the debugging process.
g important to you, define
g as the (protected) method out of
f though It can break your design.
g in the original code and then call
apply . It will be executed during the trial and if unchanging, then the exception will be raised, which will cause the test to fail. It will also be in regular code, but
emphasis (and colleagues) can be removed as a compiler (e.g., see).
Comments
Post a Comment