41 #if GTEST_OS_WINDOWS_MOBILE
43 #elif GTEST_OS_WINDOWS
45 #endif // GTEST_OS_WINDOWS_MOBILE
54 FilePath GetAbsolutePathOf(
const FilePath& relative_path) {
55 return FilePath::ConcatPaths(FilePath::GetCurrentDir(), relative_path);
60 TEST(XmlOutputTest, GetOutputFormatDefault) {
62 EXPECT_STREQ(
"", UnitTestOptions::GetOutputFormat().c_str());
65 TEST(XmlOutputTest, GetOutputFormat) {
67 EXPECT_STREQ(
"xml", UnitTestOptions::GetOutputFormat().c_str());
70 TEST(XmlOutputTest, GetOutputFileDefault) {
72 EXPECT_EQ(GetAbsolutePathOf(FilePath(
"test_detail.xml")).
string(),
73 UnitTestOptions::GetAbsolutePathToOutputFile());
76 TEST(XmlOutputTest, GetOutputFileSingleFile) {
78 EXPECT_EQ(GetAbsolutePathOf(FilePath(
"filename.abc")).
string(),
79 UnitTestOptions::GetAbsolutePathToOutputFile());
82 TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
84 const std::string expected_output_file =
88 const std::string& output_file =
89 UnitTestOptions::GetAbsolutePathToOutputFile();
93 EXPECT_EQ(expected_output_file, output_file.c_str());
101 _strcmpi(
"googletest-options-test", exe_str.c_str()) == 0 ||
102 _strcmpi(
"gtest-options-ex_test", exe_str.c_str()) == 0 ||
103 _strcmpi(
"gtest_all_test", exe_str.c_str()) == 0 ||
104 _strcmpi(
"gtest_dll_test", exe_str.c_str()) == 0;
107 strcasecmp(
"googletest-options-test", exe_str.c_str()) == 0 ||
108 strcasecmp(
"gtest-options-ex_test", exe_str.c_str()) == 0 ||
109 strcasecmp(
"gtest_all_test", exe_str.c_str()) == 0 ||
110 strcasecmp(
"gtest_dll_test", exe_str.c_str()) == 0;
111 #elif GTEST_OS_FUCHSIA
112 const bool success = exe_str ==
"app";
115 exe_str ==
"googletest-options-test" ||
116 exe_str ==
"gtest_all_test" ||
117 exe_str ==
"lt-gtest_all_test" ||
118 exe_str ==
"gtest_dll_test";
119 #endif // GTEST_OS_WINDOWS
121 FAIL() <<
"GetCurrentExecutableName() returns " << exe_str;
124 #if !GTEST_OS_FUCHSIA
126 class XmlOutputChangeDirTest :
public Test {
128 void SetUp()
override {
133 FilePath::GetCurrentDir().string());
136 void TearDown()
override {
143 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefault) {
146 FilePath(
"test_detail.xml")).
string(),
147 UnitTestOptions::GetAbsolutePathToOutputFile());
150 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefaultXML) {
153 FilePath(
"test_detail.xml")).
string(),
154 UnitTestOptions::GetAbsolutePathToOutputFile());
157 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativeFile) {
160 FilePath(
"filename.abc")).
string(),
161 UnitTestOptions::GetAbsolutePathToOutputFile());
164 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {
166 const std::string expected_output_file =
167 FilePath::ConcatPaths(
171 const std::string& output_file =
172 UnitTestOptions::GetAbsolutePathToOutputFile();
176 EXPECT_EQ(expected_output_file, output_file.c_str());
180 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsoluteFile) {
182 GTEST_FLAG(output) =
"xml:c:\\tmp\\filename.abc";
183 EXPECT_EQ(FilePath(
"c:\\tmp\\filename.abc").
string(),
184 UnitTestOptions::GetAbsolutePathToOutputFile());
187 EXPECT_EQ(FilePath(
"/tmp/filename.abc").
string(),
188 UnitTestOptions::GetAbsolutePathToOutputFile());
192 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) {
194 const std::string path =
"c:\\tmp\\";
196 const std::string path =
"/tmp/";
200 const std::string expected_output_file =
202 const std::string& output_file =
203 UnitTestOptions::GetAbsolutePathToOutputFile();
208 EXPECT_EQ(expected_output_file, output_file.c_str());
212 #endif // !GTEST_OS_FUCHSIA
#define EXPECT_STRCASEEQ(s1, s2)
#define EXPECT_NE(val1, val2)
int ChDir(const char *dir)
TEST_F(ListenerTest, DoesFoo)
#define EXPECT_STREQ(s1, s2)
FilePath GetCurrentExecutableName()
FilePath original_working_dir_
#define EXPECT_EQ(val1, val2)
TEST(IsXDigitTest, WorksForNarrowAscii)