From c38589d8615ba3ff93736cb02d12b3c8ceb68094 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 17 Jun 2017 15:18:30 +0300 Subject: [PATCH] Fix the order of init and driver creation --- tests/basic/test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/basic/test.cpp b/tests/basic/test.cpp index ce9a0cd7..e3190085 100644 --- a/tests/basic/test.cpp +++ b/tests/basic/test.cpp @@ -33,16 +33,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; TEST(Basic, SendKeyboardIsNotCalledWhenNoKeyIsPressed) { - keyboard_init(); TestDriver driver; + EXPECT_CALL(driver, send_keyboard_mock(_)); + keyboard_init(); EXPECT_CALL(driver, keyboard_leds_mock()).WillRepeatedly(Return(0)); EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); keyboard_task(); } TEST(Basic, SendKeyboardIsCalledWhenAKeyIsPressed) { - keyboard_init(); TestDriver driver; + EXPECT_CALL(driver, send_keyboard_mock(_)); + keyboard_init(); press_key(0, 0); EXPECT_CALL(driver, keyboard_leds_mock()).WillRepeatedly(Return(0)); EXPECT_CALL(driver, send_keyboard_mock(_));