andrey-zherikov / argparse

Parser for command-line arguments
https://andrey-zherikov.github.io/argparse/
Boost Software License 1.0
30 stars 6 forks source link

Unit tests should not produce any output #125

Closed SirNickolas closed 8 months ago

SirNickolas commented 9 months ago

Currently, unit tests write to both stdout and stderr. They should do neither because they are run by clients of the library.

andrey-zherikov commented 8 months ago

Could you please elaborate what the actual problem is? Writing to stderr/stdout in unit tests is not a problem. Do you mean that library unit tests are executed when users run unit tests for their apps?

SirNickolas commented 8 months ago

Do you mean that library unit tests are executed when users run unit tests for their apps?

Please, excuse me. I believed so. Several years ago, dub build -b unittest (or was it -c unittest?..) had been building every dependency with unit tests enabled. I haven’t noticed it changed the behavior: now only the main package has -unittest passed to the compiler invocation so library unit tests are not run anymore (unless it is a sourceLibrary).

I agree it was a better idea to fix it in the toolchain rather than force every library to deal with it somehow.