From c2b13bd77b71ea73db12a6cda64871565036a6dc Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Sun, 18 Dec 2022 21:55:14 +0100 Subject: Introduce VERIFY_AND_CLEAR shorthand (#19370) Which is just a syntactic sugar for testing::Mock::VerifyAndClearExpectations to reduce the visual clutter in unit-tests. --- .../retro_tapping/test_tap_hold.cpp | 4 ++-- .../retro_tapping/test_tapping.cpp | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'tests/tap_hold_configurations/retro_tapping') diff --git a/tests/tap_hold_configurations/retro_tapping/test_tap_hold.cpp b/tests/tap_hold_configurations/retro_tapping/test_tap_hold.cpp index e08c600dbd..2b49cddcce 100644 --- a/tests/tap_hold_configurations/retro_tapping/test_tap_hold.cpp +++ b/tests/tap_hold_configurations/retro_tapping/test_tap_hold.cpp @@ -38,7 +38,7 @@ TEST_F(RetroTapping, tap_and_hold_mod_tap_hold_key) { EXPECT_NO_REPORT(driver); mod_tap_hold_key.press(); idle_for(TAPPING_TERM); - testing::Mock::VerifyAndClearExpectations(&driver); + VERIFY_AND_CLEAR(driver); /* Release mod-tap-hold key. */ /* TODO: Why is LSHIFT send at all? */ @@ -48,5 +48,5 @@ TEST_F(RetroTapping, tap_and_hold_mod_tap_hold_key) { EXPECT_EMPTY_REPORT(driver); mod_tap_hold_key.release(); run_one_scan_loop(); - testing::Mock::VerifyAndClearExpectations(&driver); + VERIFY_AND_CLEAR(driver); } diff --git a/tests/tap_hold_configurations/retro_tapping/test_tapping.cpp b/tests/tap_hold_configurations/retro_tapping/test_tapping.cpp index 42139d50da..db81c39101 100644 --- a/tests/tap_hold_configurations/retro_tapping/test_tapping.cpp +++ b/tests/tap_hold_configurations/retro_tapping/test_tapping.cpp @@ -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); } -- cgit v1.2.3