| 55 | }; |
| 56 | |
| 57 | TEST(CommandLineParserTest, WorkingDirectories1) { |
| 58 | // Trivial case: One root working directory and many relative sub directories |
| 59 | // |
| 60 | // dira |
| 61 | // dirb1 |
| 62 | // dirc |
| 63 | // file_a.sv |
| 64 | // file_b.sv |
| 65 | // dird |
| 66 | // file.sv |
| 67 | // dirb2 |
| 68 | // dirc |
| 69 | // file_a.sv |
| 70 | // file_b.sv |
| 71 | // dird |
| 72 | // file.sv |
| 73 | |
| 74 | std::error_code ec; |
| 75 | const fs::path programPath = FileSystem::getProgramPath().string(); |
| 76 | const fs::path testdir = FileSystem::normalize(testing::TempDir()) / "wd1"; |
| 77 | |
| 78 | const std::vector<fs::path> dirs{ |
| 79 | testdir / "dira" / "dirb1" / "dirc", |
| 80 | testdir / "dira" / "dirb1" / "dird", |
| 81 | testdir / "dira" / "dirb2" / "dirc", |
| 82 | testdir / "dira" / "dirb2" / "dird", |
| 83 | }; |
| 84 | |
| 85 | bool toggle = true; |
| 86 | std::set<fs::path> expectedSourceFiles; |
| 87 | for (const fs::path& dir : dirs) { |
| 88 | fs::create_directories(dir, ec); |
| 89 | EXPECT_FALSE(ec) << ec; |
| 90 | |
| 91 | if (toggle) { |
| 92 | fs::path filepath_a = dir / "file_a.sv"; |
| 93 | std::ofstream strm_a(filepath_a); |
| 94 | EXPECT_TRUE(strm_a.is_open()); |
| 95 | strm_a.close(); |
| 96 | |
| 97 | fs::path filepath_b = dir / "file_b.sv"; |
| 98 | std::ofstream strm_b(filepath_b); |
| 99 | EXPECT_TRUE(strm_b.is_open()); |
| 100 | strm_b.close(); |
| 101 | expectedSourceFiles.insert(filepath_a); |
| 102 | expectedSourceFiles.insert(filepath_b); |
| 103 | } else { |
| 104 | fs::path filepath = dir / "file.sv"; |
| 105 | std::ofstream strm(filepath); |
| 106 | EXPECT_TRUE(strm.is_open()); |
| 107 | strm.close(); |
| 108 | expectedSourceFiles.insert(filepath); |
| 109 | } |
| 110 | |
| 111 | toggle = !toggle; |
| 112 | } |
| 113 | |
| 114 | const std::vector<std::string> args{ |
nothing calls this directly
no test coverage detected