Hi, I wrote some unittests using the built-in d unittest and a came across 2 problems:
1) I have some code that accepts both delegates and functions. How can a unittest explicitly check the function part? Whenever I add a function in an unittest block it becomes a delegate. --------------------------------------------------- void add(T)(T handler) if (is(T == void function())){} void add(T)(T handler) if (is(T == void delegate())){} unittest { //always a delegate void handler() {}; add(&handler); } ---------------------------------------------------- 2) I know Errors should not be caught. But when I expect a function to throw in debug mode, but not necessarily in release mode (assert), I have to check for both Errors and Exceptions --> Throwable. Is it OK to catch Throwables in this case? ---------------------------------------------------- unittest { void handler() {}; bool thrown = false; try add(&handler); catch(Throwable) thrown = true; assert(thrown); } ---------------------------------------------------- -- Johannes Pfau