1
0
Fork 0

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:
Stefan Kerkmann 2022-12-18 21:55:14 +01:00 committed by GitHub
parent 7aa2d791f6
commit c2b13bd77b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 257 additions and 251 deletions

View file

@ -35,18 +35,18 @@ TEST_F(Tapping, HoldA_SHFT_T_KeyReportsShift) {
EXPECT_NO_REPORT(driver);
mod_tap_hold_key.press();
idle_for(TAPPING_TERM);
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
EXPECT_REPORT(driver, (KC_LSFT));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
EXPECT_EMPTY_REPORT(driver);
EXPECT_REPORT(driver, (KC_P));
EXPECT_EMPTY_REPORT(driver);
mod_tap_hold_key.release();
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
}
TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) {
@ -60,45 +60,45 @@ TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) {
EXPECT_NO_REPORT(driver);
key_shift_hold_p_tap.press();
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
/* Release mod_tap_hold key */
EXPECT_REPORT(driver, (KC_P));
EXPECT_EMPTY_REPORT(driver);
key_shift_hold_p_tap.release();
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
/* Press mod_tap_hold key again */
EXPECT_REPORT(driver, (KC_P));
key_shift_hold_p_tap.press();
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
/* Release mod_tap_hold key again */
EXPECT_EMPTY_REPORT(driver);
key_shift_hold_p_tap.release();
idle_for(TAPPING_TERM + 1);
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
/* Press mod_tap_hold key again */
EXPECT_NO_REPORT(driver);
key_shift_hold_p_tap.press();
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
/* Release mod_tap_hold key again */
EXPECT_REPORT(driver, (KC_P));
EXPECT_EMPTY_REPORT(driver);
key_shift_hold_p_tap.release();
idle_for(TAPPING_TERM + 1);
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
/* Press mod_tap_hold key again */
EXPECT_NO_REPORT(driver);
key_shift_hold_p_tap.press();
idle_for(TAPPING_TERM);
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
/* Release mod_tap_hold key again */
/* TODO: Why is KC_LSFT send? */
@ -108,5 +108,5 @@ TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) {
EXPECT_EMPTY_REPORT(driver);
key_shift_hold_p_tap.release();
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
VERIFY_AND_CLEAR(driver);
}