We're long overdue for a "D is awesome" post

Walter Bright newshound2 at digitalmars.com
Tue May 30 23:27:05 UTC 2023


Excellent! The technique you're exhibiting is called "mocking". It works 
especially well when a function's inputs and outputs are properly parameterized.

When I fixed the D lexer.d to not access any globals, I was able to simplify the 
unittests for it by mocking up the inputs and outputs. For example, instead of 
having to use the global "gagging" switch to suppress error messages, I used a 
mock error handler that just did nothing.


On 5/30/2023 2:42 PM, H. S. Teoh wrote:
> So here's one.



More information about the Digitalmars-d mailing list