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

Use BOOST_SCOPE_EXIT to clean up after tests that change global state #2953

Open
daira opened this issue Feb 16, 2018 · 0 comments
Open

Use BOOST_SCOPE_EXIT to clean up after tests that change global state #2953

daira opened this issue Feb 16, 2018 · 0 comments
Labels
A-testing Area: Tests and testing infrastructure C-cleanup Category: PRs that clean code up or issues documenting cleanup.

Comments

@daira
Copy link
Contributor

daira commented Feb 16, 2018

If a test modifies global state and then doesn't reach the cleanup code because of an exception, that can be exceptionally (haha) annoying when debugging tests.

BOOST_SCOPE_EXIT uses RAII to simulate the try..finally construct from Java and other languages. Note that it needs to go just before the code that modifies the global state.

@daira daira added A-testing Area: Tests and testing infrastructure C-cleanup Category: PRs that clean code up or issues documenting cleanup. labels Feb 16, 2018
@daira daira added this to the 1.1.0 milestone Feb 16, 2018
@str4d str4d modified the milestones: v1.1.0, v1.1.1 Apr 2, 2018
@str4d str4d added this to 1.1.1: Testing in Release planning Apr 5, 2018
@str4d str4d removed this from the v1.1.1 milestone Apr 26, 2018
@str4d str4d removed this from 1.1.1: Testing in Release planning Apr 26, 2018
@mdr0id mdr0id added this to Product Backlog in Arborist Team Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testing Area: Tests and testing infrastructure C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Projects
Arborist Team
  
Needs Prioritization
Continuous Improvement
  
Awaiting triage
Development

No branches or pull requests

2 participants