Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend the use of some testing macros to examples #1275

jhlegarreta opened this issue Sep 25, 2019 · 0 comments


Copy link

commented Sep 25, 2019


Derived from this PR to fix a bug it would may be useful to be able to use the ITK_TRY_EXPECT_NO_EXCEPTION macro also in the ITK Examples.

The macro is currently defined in itkTestingMacros.h, and is virtually never used in the ITK code base or Examples because may be including [itkTestingMacros.h] in such files is counter-intuitive indeed.

So may be it should be moved to elsewhere, since in reality, try/catch blocks are not really limited to tests and examples.

It would avoid writing boilerplate code, and making the exception messages consistent.

Impact analysis

It would allow to avoid bugs such as the one mentioned, would make the code more consistent, have less boilerplate code, and no downsides to it can are foreseen.

Expected behavior

Be able to call

ITK_TRY_EXPECT_NO_EXCEPTION( filter->Update() );

macros from the ITK code base or Examples including some header file other than itkTestingMacros.h, which seems counter-intuitive.

Actual behavior

The ITK_TRY_EXPECT_NO_EXCEPTION macros is virtually never used in the ITK code base or the Examples.



Additional Information

One may wonder what to do with TRY_EXPECT_EXCEPTION then, since that is really intended for tests.

Naming may need to be taken care of. Almost all macros in itkTestingMacros have the prefix TEST. And a few do not.

Related to #1273.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.