Skip to content

Commit

Permalink
move gmock files, update gmock usages
Browse files Browse the repository at this point in the history
 * all gmock/gtest files moved to `gmock` directory (like a library name)
 * CMake `gmock` target updated to export includes as "gtest/gtest.h" or "gmock/gtest.h" only
 * includes in tests updated: "gtest.h" -> "gtest/gtest.h", "gmock.h" -> "gmock/gmock.h"
 * removed duplications of `target_include_directories` for gmock directories (CMake manages them)
 * `.clang-format` file added to `gmock` directory to prevent formatting there
  • Loading branch information
alexezeder committed Apr 26, 2021
1 parent 69bdc20 commit 7f14bfb
Show file tree
Hide file tree
Showing 22 changed files with 22 additions and 22 deletions.
9 changes: 3 additions & 6 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
# pre-compiled copy of Google Test (for example, into /usr/local)?"
# at http://code.google.com/p/googletest/wiki/FAQ for more details.
add_library(gmock STATIC
gmock-gtest-all.cc gmock/gmock.h gtest/gtest.h gtest/gtest-spi.h)
gmock/gmock-gtest-all.cc gmock/include/gmock/gmock.h
gmock/include/gtest/gtest.h gmock/include/gtest/gtest-spi.h)
target_compile_definitions(gmock PUBLIC GTEST_HAS_STD_WSTRING=1)
target_include_directories(gmock SYSTEM PUBLIC . gmock gtest)
target_include_directories(gmock SYSTEM PUBLIC gmock/include)

find_package(Threads)
if (Threads_FOUND)
Expand Down Expand Up @@ -37,7 +38,6 @@ target_compile_definitions(gmock

set(TEST_MAIN_SRC test-main.cc gtest-extra.cc gtest-extra.h util.cc)
add_library(test-main STATIC ${TEST_MAIN_SRC})
target_include_directories(test-main SYSTEM PUBLIC gtest gmock)
target_link_libraries(test-main gmock fmt)

include(CheckCXXCompilerFlag)
Expand Down Expand Up @@ -75,7 +75,6 @@ function(add_fmt_test name)
if (FMT_WERROR)
target_compile_options(${name} PRIVATE ${WERROR_FLAG})
endif ()
target_include_directories(${name} SYSTEM PUBLIC gtest gmock)
add_test(NAME ${name} COMMAND ${name})
endfunction()

Expand Down Expand Up @@ -123,7 +122,6 @@ if (NOT MSVC_STATIC_RUNTIME)
target_include_directories(
posix-mock-test PRIVATE ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(posix-mock-test gmock)
target_include_directories(posix-mock-test SYSTEM PUBLIC gtest gmock)
if (FMT_PEDANTIC)
target_compile_options(posix-mock-test PRIVATE ${PEDANTIC_COMPILE_FLAGS})
endif ()
Expand All @@ -137,7 +135,6 @@ endif ()
add_fmt_executable(header-only-test
header-only-test.cc header-only-test2.cc test-main.cc)
target_link_libraries(header-only-test gmock)
target_include_directories(header-only-test SYSTEM PUBLIC gtest gmock)
if (TARGET fmt-header-only)
target_link_libraries(header-only-test fmt-header-only)
else ()
Expand Down
2 changes: 1 addition & 1 deletion test/args-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "fmt/args.h"

#include "gtest.h"
#include "gtest/gtest.h"

TEST(args_test, basic) {
auto store = fmt::dynamic_format_arg_store<fmt::format_context>();
Expand Down
2 changes: 1 addition & 1 deletion test/assert-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// For the license information refer to format.h.

#include "fmt/core.h"
#include "gtest.h"
#include "gtest/gtest.h"

TEST(assert_test, fail) {
#if GTEST_HAS_DEATH_TEST
Expand Down
2 changes: 1 addition & 1 deletion test/compile-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "fmt/chrono.h"
#include "fmt/compile.h"
#include "gmock.h"
#include "gmock/gmock.h"
#include "gtest-extra.h"
#include "util.h"

Expand Down
2 changes: 1 addition & 1 deletion test/core-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <string> // std::string
#include <type_traits> // std::is_same

#include "gmock.h"
#include "gmock/gmock.h"

#if defined(FMT_COMPILE_TIME_CHECKS) && FMT_COMPILE_TIME_CHECKS
# include "fmt/format.h"
Expand Down
2 changes: 1 addition & 1 deletion test/format-impl-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "../src/format.cc"
#include "fmt/printf.h"
#include "gmock.h"
#include "gmock/gmock.h"
#include "gtest-extra.h"
#include "util.h"

Expand Down
2 changes: 1 addition & 1 deletion test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#undef index

#include "gmock.h"
#include "gmock/gmock.h"
#include "gtest-extra.h"
#include "mock-allocator.h"
#include "util.h"
Expand Down
3 changes: 3 additions & 0 deletions test/gmock/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Disable clang-format here
DisableFormat: true
SortIncludes: Never
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/gtest-extra.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string>

#include "fmt/os.h"
#include "gmock.h"
#include "gmock/gmock.h"

#define FMT_TEST_THROW_(statement, expected_exception, expected_message, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
Expand Down
2 changes: 1 addition & 1 deletion test/locale-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <complex>

#include "gmock.h"
#include "gmock/gmock.h"

using fmt::detail::max_value;

Expand Down
2 changes: 1 addition & 1 deletion test/mock-allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define FMT_MOCK_ALLOCATOR_H_

#include "fmt/format.h"
#include "gmock.h"
#include "gmock/gmock.h"

template <typename T> class mock_allocator {
public:
Expand Down
2 changes: 1 addition & 1 deletion test/ostream-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ template <> struct formatter<test> : formatter<int> {

#include "fmt/ostream.h"
#include "fmt/ranges.h"
#include "gmock.h"
#include "gmock/gmock.h"
#include "gtest-extra.h"
#include "util.h"

Expand Down
2 changes: 1 addition & 1 deletion test/posix-mock-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# undef ERROR
#endif

#include "gmock.h"
#include "gmock/gmock.h"
#include "gtest-extra.h"
#include "util.h"

Expand Down
2 changes: 1 addition & 1 deletion test/ranges-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <string>
#include <vector>

#include "gtest.h"
#include "gtest/gtest.h"

#if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 601
# define FMT_RANGES_TEST_ENABLE_C_STYLE_ARRAY
Expand Down
2 changes: 1 addition & 1 deletion test/scan-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <climits>

#include "gmock.h"
#include "gmock/gmock.h"
#include "gtest-extra.h"

TEST(ScanTest, ReadText) {
Expand Down
2 changes: 1 addition & 1 deletion test/std-format-test.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <format>

#include "gtest.h"
#include "gtest/gtest.h"

TEST(StdFormatTest, Escaping) {
using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion test/test-assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <stdexcept>

#include "gtest.h"
#include "gtest/gtest.h"

class assertion_failure : public std::logic_error {
public:
Expand Down
2 changes: 1 addition & 1 deletion test/test-main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <cstdlib>

#include "gtest.h"
#include "gtest/gtest.h"

#ifdef _WIN32
# include <windows.h>
Expand Down

0 comments on commit 7f14bfb

Please sign in to comment.