diff options
Diffstat (limited to 'uunit.h')
| -rw-r--r-- | uunit.h | 15 | 
1 files changed, 12 insertions, 3 deletions
| @@ -66,13 +66,22 @@ public:  		for(auto suite = uUnit::suite_list; suite; suite = suite->next_unit)  		{ -			for(auto test : suite->tests) +			for(const auto& test : suite->tests)  			{  				++test_num;  				try  				{ -					suite->setup(); -					test.func(); +					try +					{ +						suite->setup(); +						test.func(); +					} +					catch(...) +					{ +						// call teardown and ignore exceptions +						try { suite->teardown(); } catch(...) {} +						throw; // rethrow setup/test.func exception +					}  					suite->teardown();  				}  				catch(test_result& result) | 
