@@ -55,25 +55,17 @@ namespace {
55
55
}
56
56
57
57
58
- constexpr auto EndsWithDirSeparator = []() {
59
- return testing::Truly ([](const auto & path) { return path.string ().ends_with (NAS2D::Filesystem::dirSeparator ()); });
60
- };
61
-
62
-
63
- constexpr auto HasPartialPath = [](const auto & subString) {
64
- return testing::Truly ([&](const auto & path) { return path.string ().find (subString) != std::string::npos; });
65
- };
66
-
67
-
68
58
TEST_F (Filesystem, basePath) {
69
59
// Result is a directory, and should end with a directory separator
70
- EXPECT_THAT (fs.basePath (), EndsWithDirSeparator ());
60
+ const auto dirSeparator = NAS2D::Filesystem::dirSeparator ();
61
+ EXPECT_THAT (fs.basePath (), testing::EndsWith (dirSeparator));
71
62
}
72
63
73
64
TEST_F (Filesystem, prefPath) {
74
65
// Result is a directory, and should end with a directory separator
75
- EXPECT_THAT (fs.prefPath (), EndsWithDirSeparator ());
76
- EXPECT_THAT (fs.prefPath (), HasPartialPath (AppName));
66
+ const auto dirSeparator = NAS2D::Filesystem::dirSeparator ();
67
+ EXPECT_THAT (fs.prefPath (), testing::EndsWith (dirSeparator));
68
+ EXPECT_THAT (fs.prefPath (), testing::EndsWith (AppName + dirSeparator));
77
69
}
78
70
79
71
TEST_F (Filesystem, findInParentsExist) {
@@ -94,8 +86,8 @@ TEST_F(Filesystem, findInParentsNotExist) {
94
86
TEST_F (Filesystem, searchPath) {
95
87
auto pathList = fs.searchPath ();
96
88
EXPECT_EQ (3u , pathList.size ());
97
- EXPECT_THAT (pathList, Contains (HasPartialPath (AppName)));
98
- EXPECT_THAT (pathList, Contains (HasPartialPath (" data/" )));
89
+ EXPECT_THAT (pathList, Contains (testing::EndsWith (AppName + NAS2D::Filesystem::dirSeparator () )));
90
+ EXPECT_THAT (pathList, Contains (testing::EndsWith (" data/" )));
99
91
}
100
92
101
93
TEST_F (Filesystem, directoryList) {
@@ -164,7 +156,7 @@ TEST_F(Filesystem, mountUnmount) {
164
156
165
157
EXPECT_FALSE (fs.exists (extraFile));
166
158
EXPECT_NO_THROW (fs.mount (extraMount));
167
- EXPECT_THAT (fs.searchPath (), Contains (HasPartialPath (extraMount)));
159
+ EXPECT_THAT (fs.searchPath (), Contains (testing::EndsWith (extraMount)));
168
160
EXPECT_TRUE (fs.exists (extraFile));
169
161
170
162
EXPECT_NO_THROW (fs.unmount (extraMount));
0 commit comments