Commit dac3e879 authored by zhanyong.wan's avatar zhanyong.wan
Browse files

Include gtest headers as user headers instead of system headers.

parent 88e0df62
...@@ -42,8 +42,8 @@ $var n = 50 $$ Maximum length of type lists we want to support. ...@@ -42,8 +42,8 @@ $var n = 50 $$ Maximum length of type lists we want to support.
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
#include <gtest/internal/gtest-port.h> #include "gtest/internal/gtest-port.h"
#include <gtest/internal/gtest-string.h> #include "gtest/internal/gtest-string.h"
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <gtest/gtest.h> #include "gtest/gtest.h"
using ::testing::EmptyTestEventListener; using ::testing::EmptyTestEventListener;
using ::testing::InitGoogleTest; using ::testing::InitGoogleTest;
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include <limits.h> #include <limits.h>
#include "sample1.h" #include "sample1.h"
#include <gtest/gtest.h> #include "gtest/gtest.h"
// Step 2. Use the TEST macro to define your tests. // Step 2. Use the TEST macro to define your tests.
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
// needed. // needed.
#include "sample2.h" #include "sample2.h"
#include <gtest/gtest.h> #include "gtest/gtest.h"
// In this example, we test the MyString class (a simple string). // In this example, we test the MyString class (a simple string).
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
// </TechnicalDetails> // </TechnicalDetails>
#include "sample3-inl.h" #include "sample3-inl.h"
#include <gtest/gtest.h> #include "gtest/gtest.h"
// To use a test fixture, derive a class from testing::Test. // To use a test fixture, derive a class from testing::Test.
class QueueTest : public testing::Test { class QueueTest : public testing::Test {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// //
// Author: wan@google.com (Zhanyong Wan) // Author: wan@google.com (Zhanyong Wan)
#include <gtest/gtest.h> #include "gtest/gtest.h"
#include "sample4.h" #include "sample4.h"
// Tests the Increment() method. // Tests the Increment() method.
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include <limits.h> #include <limits.h>
#include <time.h> #include <time.h>
#include "sample3-inl.h" #include "sample3-inl.h"
#include <gtest/gtest.h> #include "gtest/gtest.h"
#include "sample1.h" #include "sample1.h"
// In this sample, we want to ensure that every test finishes within // In this sample, we want to ensure that every test finishes within
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
// The interface and its implementations are in this header. // The interface and its implementations are in this header.
#include "prime_tables.h" #include "prime_tables.h"
#include <gtest/gtest.h> #include "gtest/gtest.h"
// First, we define some factory functions for creating instances of // First, we define some factory functions for creating instances of
// the implementations. You may be able to skip this step if all your // the implementations. You may be able to skip this step if all your
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
// The interface and its implementations are in this header. // The interface and its implementations are in this header.
#include "prime_tables.h" #include "prime_tables.h"
#include <gtest/gtest.h> #include "gtest/gtest.h"
#if GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
// Use class definitions to test from this header. // Use class definitions to test from this header.
#include "prime_tables.h" #include "prime_tables.h"
#include <gtest/gtest.h> #include "gtest/gtest.h"
#if GTEST_HAS_COMBINE #if GTEST_HAS_COMBINE
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <stdio.h> #include <stdio.h>
#include <gtest/gtest.h> #include "gtest/gtest.h"
using ::testing::EmptyTestEventListener; using ::testing::EmptyTestEventListener;
using ::testing::InitGoogleTest; using ::testing::InitGoogleTest;
......
...@@ -67,8 +67,8 @@ import sys ...@@ -67,8 +67,8 @@ import sys
# Test root directory. # Test root directory.
DEFAULT_GTEST_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..') DEFAULT_GTEST_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
# Regex for matching '#include <gtest/...>'. # Regex for matching '#include "gtest/..."'.
INCLUDE_GTEST_FILE_REGEX = re.compile(r'^\s*#\s*include\s*<(gtest/.+)>') INCLUDE_GTEST_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(gtest/.+)"')
# Regex for matching '#include "src/..."'. # Regex for matching '#include "src/..."'.
INCLUDE_SRC_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(src/.+)"') INCLUDE_SRC_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(src/.+)"')
...@@ -162,7 +162,7 @@ def FuseGTestH(gtest_root, output_dir): ...@@ -162,7 +162,7 @@ def FuseGTestH(gtest_root, output_dir):
for line in file(os.path.join(gtest_root, gtest_header_path), 'r'): for line in file(os.path.join(gtest_root, gtest_header_path), 'r'):
m = INCLUDE_GTEST_FILE_REGEX.match(line) m = INCLUDE_GTEST_FILE_REGEX.match(line)
if m: if m:
# It's '#include <gtest/...>' - let's process it recursively. # It's '#include "gtest/..."' - let's process it recursively.
ProcessFile('include/' + m.group(1)) ProcessFile('include/' + m.group(1))
else: else:
# Otherwise we copy the line unchanged to the output file. # Otherwise we copy the line unchanged to the output file.
...@@ -191,19 +191,19 @@ def FuseGTestAllCcToFile(gtest_root, output_file): ...@@ -191,19 +191,19 @@ def FuseGTestAllCcToFile(gtest_root, output_file):
m = INCLUDE_GTEST_FILE_REGEX.match(line) m = INCLUDE_GTEST_FILE_REGEX.match(line)
if m: if m:
if 'include/' + m.group(1) == GTEST_SPI_H_SEED: if 'include/' + m.group(1) == GTEST_SPI_H_SEED:
# It's '#include <gtest/gtest-spi.h>'. This file is not # It's '#include "gtest/gtest-spi.h"'. This file is not
# #included by <gtest/gtest.h>, so we need to process it. # #included by "gtest/gtest.h", so we need to process it.
ProcessFile(GTEST_SPI_H_SEED) ProcessFile(GTEST_SPI_H_SEED)
else: else:
# It's '#include <gtest/foo.h>' where foo is not gtest-spi. # It's '#include "gtest/foo.h"' where foo is not gtest-spi.
# We treat it as '#include <gtest/gtest.h>', as all other # We treat it as '#include "gtest/gtest.h"', as all other
# gtest headers are being fused into gtest.h and cannot be # gtest headers are being fused into gtest.h and cannot be
# #included directly. # #included directly.
# There is no need to #include <gtest/gtest.h> more than once. # There is no need to #include "gtest/gtest.h" more than once.
if not GTEST_H_SEED in processed_files: if not GTEST_H_SEED in processed_files:
processed_files.add(GTEST_H_SEED) processed_files.add(GTEST_H_SEED)
output_file.write('#include <%s>\n' % (GTEST_H_OUTPUT,)) output_file.write('#include "%s"\n' % (GTEST_H_OUTPUT,))
else: else:
m = INCLUDE_SRC_FILE_REGEX.match(line) m = INCLUDE_SRC_FILE_REGEX.match(line)
if m: if m:
......
...@@ -386,8 +386,8 @@ def UnitTestPreamble(): ...@@ -386,8 +386,8 @@ def UnitTestPreamble():
#include <iostream> #include <iostream>
#include <gtest/gtest.h> #include "gtest/gtest.h"
#include <gtest/gtest-spi.h> #include "gtest/gtest-spi.h"
// A user-defined data type. // A user-defined data type.
struct Bool { struct Bool {
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
// This line ensures that gtest.h can be compiled on its own, even // This line ensures that gtest.h can be compiled on its own, even
// when it's fused. // when it's fused.
#include <gtest/gtest.h> #include "gtest/gtest.h"
// The following lines pull in the real gtest *.cc files. // The following lines pull in the real gtest *.cc files.
#include "src/gtest.cc" #include "src/gtest.cc"
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
// //
// This file implements death tests. // This file implements death tests.
#include <gtest/gtest-death-test.h> #include "gtest/gtest-death-test.h"
#include <gtest/internal/gtest-port.h> #include "gtest/internal/gtest-port.h"
#if GTEST_HAS_DEATH_TEST #if GTEST_HAS_DEATH_TEST
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
#endif // GTEST_HAS_DEATH_TEST #endif // GTEST_HAS_DEATH_TEST
#include <gtest/gtest-message.h> #include "gtest/gtest-message.h"
#include <gtest/internal/gtest-string.h> #include "gtest/internal/gtest-string.h"
// Indicates that this translation unit is part of Google Test's // Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
// //
// Authors: keith.ray@gmail.com (Keith Ray) // Authors: keith.ray@gmail.com (Keith Ray)
#include <gtest/internal/gtest-filepath.h> #include "gtest/internal/gtest-filepath.h"
#include <gtest/internal/gtest-port.h> #include "gtest/internal/gtest-port.h"
#include <stdlib.h> #include <stdlib.h>
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#define GTEST_PATH_MAX_ _POSIX_PATH_MAX #define GTEST_PATH_MAX_ _POSIX_PATH_MAX
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
#include <gtest/internal/gtest-string.h> #include "gtest/internal/gtest-string.h"
namespace testing { namespace testing {
namespace internal { namespace internal {
......
...@@ -56,14 +56,14 @@ ...@@ -56,14 +56,14 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <gtest/internal/gtest-port.h> #include "gtest/internal/gtest-port.h"
#if GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
#include <windows.h> // For DWORD. #include <windows.h> // For DWORD.
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
#include <gtest/gtest.h> // NOLINT #include "gtest/gtest.h" // NOLINT
#include <gtest/gtest-spi.h> #include "gtest/gtest-spi.h"
namespace testing { namespace testing {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// //
// Author: wan@google.com (Zhanyong Wan) // Author: wan@google.com (Zhanyong Wan)
#include <gtest/internal/gtest-port.h> #include "gtest/internal/gtest-port.h"
#include <limits.h> #include <limits.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -51,9 +51,9 @@ ...@@ -51,9 +51,9 @@
#include <mach/vm_map.h> #include <mach/vm_map.h>
#endif // GTEST_OS_MAC #endif // GTEST_OS_MAC
#include <gtest/gtest-spi.h> #include "gtest/gtest-spi.h"
#include <gtest/gtest-message.h> #include "gtest/gtest-message.h"
#include <gtest/internal/gtest-string.h> #include "gtest/internal/gtest-string.h"
// Indicates that this translation unit is part of Google Test's // Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
......
...@@ -42,12 +42,12 @@ ...@@ -42,12 +42,12 @@
// or void PrintTo(const Foo&, ::std::ostream*) in the namespace that // or void PrintTo(const Foo&, ::std::ostream*) in the namespace that
// defines Foo. // defines Foo.
#include <gtest/gtest-printers.h> #include "gtest/gtest-printers.h"
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <ostream> // NOLINT #include <ostream> // NOLINT
#include <string> #include <string>
#include <gtest/internal/gtest-port.h> #include "gtest/internal/gtest-port.h"
namespace testing { namespace testing {
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
// //
// The Google C++ Testing Framework (Google Test) // The Google C++ Testing Framework (Google Test)
#include <gtest/gtest-test-part.h> #include "gtest/gtest-test-part.h"
// Indicates that this translation unit is part of Google Test's // Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment