Awesome: asserts turn into writeln for ddoc'd unit tests

Vladimir Panteleev thecybershadow.lists at gmail.com
Mon Sep 18 04:52:39 UTC 2017


On Monday, 18 September 2017 at 02:40:00 UTC, Jonathan Marler 
wrote:
> I'm having a hard time seeing the benefits of this feature, 
> could you share some examples or mention some reasons how this 
> transformation is helpful? Not trying to attack the feature, 
> just curious. Thanks.

When running the unittests/examples on dlang.org, or when copying 
them and pasting in a text file and running them locally, the 
code will almost always execute with no output or other side 
effects. Generally, this isn't very useful or interesting when 
you're trying to learn about or experiment with the symbol being 
documented - it's more interesting to print the calculated 
results. The transformation converts the expected results 
(whatever the assert statement checks for equality) into a 
comment, so you can still see what the expected output was.



More information about the Digitalmars-d mailing list