Lines Matching full:filepath
32 // Google Test filepath utilities
41 #include "gtest/internal/gtest-filepath.h"
76 FilePath filepath(path);
78 filepath.RemoveTrailingPathSeparator().c_str());
87 const FilePath original_dir = FilePath::GetCurrentDir();
91 const FilePath cwd = FilePath::GetCurrentDir();
111 EXPECT_TRUE(FilePath("").IsEmpty());
112 EXPECT_TRUE(FilePath(NULL).IsEmpty());
116 EXPECT_FALSE(FilePath("a").IsEmpty());
117 EXPECT_FALSE(FilePath(".").IsEmpty());
118 EXPECT_FALSE(FilePath("a/b").IsEmpty());
119 EXPECT_FALSE(FilePath("a\\b\\").IsEmpty());
124 EXPECT_STREQ("", FilePath("").RemoveDirectoryName().c_str());
130 FilePath("afile").RemoveDirectoryName().c_str());
136 FilePath(GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
142 FilePath("adir" GTEST_PATH_SEP_).RemoveDirectoryName().c_str());
148 FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
154 FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
166 FilePath("/afile").RemoveDirectoryName().c_str());
172 FilePath("adir/").RemoveDirectoryName().c_str());
178 FilePath("adir/afile").RemoveDirectoryName().c_str());
184 FilePath("adir/subdir/afile").RemoveDirectoryName().c_str());
194 FilePath("").RemoveFileName().c_str());
197 FilePath("").RemoveFileName().c_str());
204 FilePath("adir" GTEST_PATH_SEP_).RemoveFileName().c_str());
210 FilePath("adir" GTEST_PATH_SEP_ "afile")
217 FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
224 FilePath(GTEST_PATH_SEP_ "afile").RemoveFileName().c_str());
235 FilePath("adir/").RemoveFileName().c_str());
241 FilePath("adir/afile").RemoveFileName().c_str());
247 FilePath("adir/subdir/afile").RemoveFileName().c_str());
253 FilePath("/afile").RemoveFileName().c_str());
259 FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
265 FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
271 FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
272 FilePath("bar"), 0, "xml");
277 FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
278 FilePath("bar"), 12, "xml");
283 FilePath actual = FilePath::MakeFileName(FilePath(""), FilePath("bar"),
289 FilePath actual = FilePath::MakeFileName(FilePath(""), FilePath("bar"),
295 FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
296 FilePath("bar.xml"));
301 FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_),
302 FilePath("bar.xml"));
307 FilePath actual = FilePath::ConcatPaths(FilePath(""),
308 FilePath("bar.xml"));
313 FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
314 FilePath(""));
319 FilePath actual = FilePath::ConcatPaths(FilePath(""),
320 FilePath(""));
325 FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_ "bar"),
326 FilePath("foobar.xml"));
332 FilePath actual = FilePath::ConcatPaths(
333 FilePath("foo" GTEST_PATH_SEP_),
334 FilePath("bar" GTEST_PATH_SEP_ "bar.xml"));
340 FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
341 FilePath("bar" GTEST_PATH_SEP_));
348 FilePath("").RemoveTrailingPathSeparator().c_str());
354 FilePath("foo").RemoveTrailingPathSeparator().c_str());
361 FilePath("foo" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().c_str());
364 FilePath("foo/").RemoveTrailingPathSeparator().c_str());
371 FilePath("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_)
378 FilePath("foo" GTEST_PATH_SEP_ "bar")
389 EXPECT_TRUE(FilePath(current_drive).DirectoryExists());
391 EXPECT_TRUE(FilePath("/").DirectoryExists());
406 EXPECT_FALSE(FilePath(non_drive).DirectoryExists());
416 EXPECT_FALSE(FilePath("").DirectoryExists());
424 EXPECT_TRUE(FilePath(".").DirectoryExists());
425 EXPECT_TRUE(FilePath(".\\").DirectoryExists());
429 EXPECT_TRUE(FilePath(".").DirectoryExists());
430 EXPECT_TRUE(FilePath("./").DirectoryExists());
435 EXPECT_STREQ("", FilePath(NULL).c_str());
436 EXPECT_STREQ("", FilePath(String(NULL)).c_str());
442 FilePath("foo" GTEST_PATH_SEP_ "bar").c_str());
444 FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
446 FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_
453 FilePath(GTEST_PATH_SEP_ "bar").c_str());
455 FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
457 FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
463 FilePath("foo" GTEST_PATH_SEP_).c_str());
465 FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
467 FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
477 FilePath("foo/").c_str());
479 FilePath("foo" GTEST_PATH_SEP_ "/").c_str());
481 FilePath("foo//" GTEST_PATH_SEP_).c_str());
487 FilePath default_path;
488 FilePath non_default_path("path");
495 FilePath non_default_path("path");
496 FilePath default_path;
503 const FilePath const_default_path("const_path");
504 FilePath non_default_path("path");
512 testdata_path_.Set(FilePath(String::Format("%s%s%s",
517 unique_file0_.Set(FilePath::MakeFileName(testdata_path_, FilePath("unique"),
519 unique_file1_.Set(FilePath::MakeFileName(testdata_path_, FilePath("unique"),
564 FilePath testdata_path_; // "/tmp/directory_creation/test/"
565 FilePath testdata_file_; // "/tmp/directory_creation/test"
566 FilePath unique_file0_; // "/tmp/directory_creation/test/unique.txt"
567 FilePath unique_file1_; // "/tmp/directory_creation/test/unique_1.txt"
584 FilePath file_path(FilePath::GenerateUniqueFileName(testdata_path_,
585 FilePath("unique"), "txt"));
594 FilePath file_path2(FilePath::GenerateUniqueFileName(testdata_path_,
595 FilePath("unique"), "txt"));
611 const FilePath test_detail_xml("test_detail.xml");
616 FilePath fp;
621 const FilePath fp("spicy");
624 const FilePath fp_copy(fp);
629 const FilePath fp(String("cider"));
634 const FilePath apple("apple");
635 FilePath mac("mac");
642 const FilePath file("drink");
648 EXPECT_STREQ("app", FilePath("app.exe").RemoveExtension("exe").c_str());
649 EXPECT_STREQ("APP", FilePath("APP.EXE").RemoveExtension("exe").c_str());
653 EXPECT_STREQ("app", FilePath("app").RemoveExtension("exe").c_str());
657 EXPECT_FALSE(FilePath("cola").IsDirectory());
658 EXPECT_TRUE(FilePath("koala" GTEST_PATH_SEP_).IsDirectory());
660 EXPECT_TRUE(FilePath("koala/").IsDirectory());
665 EXPECT_FALSE(FilePath("is" GTEST_PATH_SEP_ "relative").IsAbsolutePath());
666 EXPECT_FALSE(FilePath("").IsAbsolutePath());
668 EXPECT_TRUE(FilePath("c:\\" GTEST_PATH_SEP_ "is_not"
670 EXPECT_FALSE(FilePath("c:foo" GTEST_PATH_SEP_ "bar").IsAbsolutePath());
671 EXPECT_TRUE(FilePath("c:/" GTEST_PATH_SEP_ "is_not"
674 EXPECT_TRUE(FilePath(GTEST_PATH_SEP_ "is_not" GTEST_PATH_SEP_ "relative")
681 EXPECT_TRUE(FilePath("a:\\").IsRootDirectory());
682 EXPECT_TRUE(FilePath("Z:/").IsRootDirectory());
683 EXPECT_TRUE(FilePath("e://").IsRootDirectory());
684 EXPECT_FALSE(FilePath("").IsRootDirectory());
685 EXPECT_FALSE(FilePath("b:").IsRootDirectory());
686 EXPECT_FALSE(FilePath("b:a").IsRootDirectory());
687 EXPECT_FALSE(FilePath("8:/").IsRootDirectory());
688 EXPECT_FALSE(FilePath("c|/").IsRootDirectory());
690 EXPECT_TRUE(FilePath("/").IsRootDirectory());
691 EXPECT_TRUE(FilePath("//").IsRootDirectory());
692 EXPECT_FALSE(FilePath("").IsRootDirectory());
693 EXPECT_FALSE(FilePath("\\").IsRootDirectory());
694 EXPECT_FALSE(FilePath("/x").IsRootDirectory());