diff --git a/.travis.yml b/.travis.yml index f86f9830..7c32f69b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,6 @@ addons: - python-xcbgen - xcb-proto - xutils-dev - - libgtest-dev cache: directories: diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6c739cda..691685d3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -28,7 +28,7 @@ if(result) endif() # Add googletest directly to our build. This defines -# the gtest and gtest_main targets. +# the gtest, gtest_main, gmock and gmock_main targets. add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src ${CMAKE_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL) @@ -51,8 +51,8 @@ function(unit_test file tests) set(name "unit_test.${testname}") add_executable(${name} unit_tests/${file}.cpp ${sources}) - # Link against googletest - target_link_libraries(${name} gtest_main) + # Link against gmock (this automatically links against gtest) + target_link_libraries(${name} gmock_main) add_test(NAME ${name} COMMAND ${name}) diff --git a/tests/common/test.hpp b/tests/common/test.hpp index 5ee1b5e5..f3697bd3 100644 --- a/tests/common/test.hpp +++ b/tests/common/test.hpp @@ -9,7 +9,8 @@ #include #include -#include + +#include "gtest/gtest.h" #define expect(...) \ (void)((__VA_ARGS__) || (expect_fail__(#__VA_ARGS__, __FILE__, __LINE__), 0))