Introduce VERIFY_AND_CLEAR shorthand (#19370)
Which is just a syntactic sugar for testing::Mock::VerifyAndClearExpectations to reduce the visual clutter in unit-tests.
This commit is contained in:
		
							parent
							
								
									7aa2d791f6
								
							
						
					
					
						commit
						c2b13bd77b
					
				
					 21 changed files with 257 additions and 251 deletions
				
			
		| 
						 | 
				
			
			@ -98,6 +98,12 @@ class TestDriver {
 | 
			
		|||
 */
 | 
			
		||||
#define EXPECT_NO_REPORT(driver) EXPECT_ANY_REPORT(driver).Times(0)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Verify and clear all gmock expectations that have been setup until
 | 
			
		||||
 * this point.
 | 
			
		||||
 */
 | 
			
		||||
#define VERIFY_AND_CLEAR(driver) testing::Mock::VerifyAndClearExpectations(&driver)
 | 
			
		||||
 | 
			
		||||
namespace internal {
 | 
			
		||||
void expect_unicode_code_point(TestDriver& driver, uint32_t code_point);
 | 
			
		||||
} // namespace internal
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,12 +82,12 @@ TestFixture::~TestFixture() {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
    idle_for(TAPPING_TERM * 10);
 | 
			
		||||
    testing::Mock::VerifyAndClearExpectations(&driver);
 | 
			
		||||
    VERIFY_AND_CLEAR(driver);
 | 
			
		||||
 | 
			
		||||
    /* Verify that the matrix really is cleared */
 | 
			
		||||
    EXPECT_NO_REPORT(driver);
 | 
			
		||||
    idle_for(TAPPING_TERM * 10);
 | 
			
		||||
    testing::Mock::VerifyAndClearExpectations(&driver);
 | 
			
		||||
    VERIFY_AND_CLEAR(driver);
 | 
			
		||||
    m_this = nullptr;
 | 
			
		||||
 | 
			
		||||
    test_logger.info() << "test fixture clean-up end." << std::endl;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue