Unit testing a function returning void
Sergey
kornburn at yandex.ru
Thu Nov 3 16:35:39 UTC 2022
On Thursday, 3 November 2022 at 10:00:27 UTC, Bruno Pagis wrote:
> Good morning,
>
> I would like to unit test the print function (yes, I know, not
> very useful on the above example since print is merely a
> duplicate of writeln...). Is there a way to use assert to test
> the output of the print function to stdout? Something like:
Just for curiosity: we have this tremendous list of testing
libraries https://code.dlang.org/search?q=test
Maybe one of them has the 'capture stdout'
(https://docs.pytest.org/en/7.1.x/how-to/capture-stdout-stderr.html) feature?
More information about the Digitalmars-d-learn
mailing list