41#include "gtest/gtest.h"
43#if GTEST_OS_WINDOWS_MOBILE
54#define GTEST_IMPLEMENTATION_ 1
55#include "src/gtest-internal-inl.h"
56#undef GTEST_IMPLEMENTATION_
63FilePath GetAbsolutePathOf(
const FilePath& relative_path) {
69TEST(XmlOutputTest, GetOutputFormatDefault) {
74TEST(XmlOutputTest, GetOutputFormat) {
79TEST(XmlOutputTest, GetOutputFileDefault) {
81 EXPECT_EQ(GetAbsolutePathOf(FilePath(
"test_detail.xml")).
string(),
85TEST(XmlOutputTest, GetOutputFileSingleFile) {
87 EXPECT_EQ(GetAbsolutePathOf(FilePath(
"filename.abc")).
string(),
91TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
93 const std::string expected_output_file =
97 const std::string& output_file =
102 EXPECT_EQ(expected_output_file, output_file.c_str());
110 _strcmpi(
"gtest-options_test", exe_str.c_str()) == 0 ||
111 _strcmpi(
"gtest-options-ex_test", exe_str.c_str()) == 0 ||
112 _strcmpi(
"gtest_all_test", exe_str.c_str()) == 0 ||
113 _strcmpi(
"gtest_dll_test", exe_str.c_str()) == 0;
118 exe_str ==
"gtest-options_test" ||
119 exe_str ==
"gtest_all_test" ||
120 exe_str ==
"lt-gtest_all_test" ||
121 exe_str ==
"gtest_dll_test";
124 FAIL() <<
"GetCurrentExecutableName() returns " << exe_str;
127class XmlOutputChangeDirTest :
public Test {
129 virtual void SetUp() {
133 EXPECT_NE(original_working_dir_.string(),
137 virtual void TearDown() {
141 FilePath original_working_dir_;
144TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefault) {
147 FilePath(
"test_detail.xml")).
string(),
151TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefaultXML) {
154 FilePath(
"test_detail.xml")).
string(),
158TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativeFile) {
161 FilePath(
"filename.abc")).
string(),
165TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {
167 const std::string expected_output_file =
169 original_working_dir_,
172 const std::string& output_file =
177 EXPECT_EQ(expected_output_file, output_file.c_str());
181TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsoluteFile) {
183 GTEST_FLAG(output) =
"xml:c:\\tmp\\filename.abc";
184 EXPECT_EQ(FilePath(
"c:\\tmp\\filename.abc").
string(),
188 EXPECT_EQ(FilePath(
"/tmp/filename.abc").
string(),
193TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) {
195 const std::string path =
"c:\\tmp\\";
197 const std::string path =
"/tmp/";
201 const std::string expected_output_file =
203 const std::string& output_file =
209 EXPECT_EQ(expected_output_file, output_file.c_str());
const std::string & string() const
Definition gtest-filepath.h:77
static FilePath GetCurrentDir()
Definition gtest-filepath.cc:99
static FilePath ConcatPaths(const FilePath &directory, const FilePath &relative_path)
Definition gtest-filepath.cc:199
static std::string GetAbsolutePathToOutputFile()
Definition gtest.cc:426
static std::string GetOutputFormat()
Definition gtest.cc:414
bool success
Definition cold-transaction.cpp:57
#define TEST_F(test_fixture, test_name)
Definition gtest.h:2216
#define FAIL()
Definition gtest.h:1822
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1922
#define EXPECT_NE(val1, val2)
Definition gtest.h:1926
#define EXPECT_STRCASEEQ(s1, s2)
Definition gtest.h:1999
#define EXPECT_STREQ(s1, s2)
Definition gtest.h:1995
#define TEST(test_case_name, test_name)
Definition gtest.h:2187
#define GTEST_FLAG(name)
Definition gtest-port.h:2504
#define GTEST_PATH_SEP_
Definition gtest-port.h:2239
Definition document.h:406
int ChDir(const char *dir)
Definition gtest-port.h:2365
GTEST_API_ FilePath GetCurrentExecutableName()
Definition gtest.cc:399
Definition gmock-actions.h:53