|
|
 |
-
/Tests/TestsTDestinationPathProvider.cpp
(+208 -38)
-
| |
15 |
15 |
public: |
| |
16 |
16 |
MOCK_METHOD1(PathExist, bool(const TSmartPath&)); |
| |
17 |
17 |
MOCK_METHOD5(SetFileDirBasicInfo, void(const TSmartPath& pathFileDir, DWORD dwAttributes, const TFileTime& ftCreationTime, const TFileTime& ftLastAccessTime, const TFileTime& ftLastWriteTime)); |
| |
18 |
18 |
MOCK_METHOD2(SetAttributes, void(const TSmartPath& pathFileDir, DWORD dwAttributes)); |
| |
19 |
19 |
|
| |
20 |
20 |
MOCK_METHOD2(CreateDirectory, void(const TSmartPath&, bool)); |
| |
21 |
21 |
MOCK_METHOD1(RemoveDirectory, void(const TSmartPath& pathFile)); |
| |
22 |
22 |
MOCK_METHOD1(DeleteFile, void(const TSmartPath& pathFile)); |
| |
23 |
23 |
|
| |
24 |
24 |
MOCK_METHOD3(GetFileInfo, void(const TSmartPath& pathFile, TFileInfoPtr& rFileInfo, const TBasePathDataPtr& spBasePathData)); |
| |
25 |
25 |
MOCK_METHOD2(FastMove, void(const TSmartPath&, const TSmartPath&)); |
| |
26 |
26 |
|
| |
27 |
27 |
MOCK_METHOD2(CreateFinderObject, IFilesystemFindPtr(const TSmartPath& pathDir, const TSmartPath& pathMask)); |
| |
28 |
28 |
MOCK_METHOD4(CreateFileObject, IFilesystemFilePtr(IFilesystemFile::EOpenMode eMode, const TSmartPath& pathFile, bool bNoBuffering, bool bProtectReadOnlyFiles)); |
| |
29 |
29 |
|
| |
30 |
30 |
MOCK_METHOD2(GetPathsRelation, EPathsRelation(const TSmartPath& pathFirst, const TSmartPath& pathSecond)); |
| |
31 |
31 |
|
| |
32 |
32 |
MOCK_METHOD3(GetDynamicFreeSpace, void(const TSmartPath& path, unsigned long long& rullFree, unsigned long long& rullTotal)); |
| |
33 |
33 |
}; |
| |
34 |
34 |
|
| |
35 |
|
using TestTuple = std::tuple<TString, TString, bool, TString, bool, bool, TString>; |
| |
|
35 |
|
| |
|
36 |
using TestTuple = std::tuple<const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, bool, const wchar_t*, bool, bool, const wchar_t*>; |
| |
36 |
37 |
|
| |
37 |
38 |
class TransformTest : public ::testing::TestWithParam<TestTuple> |
| |
38 |
39 |
{ |
| |
39 |
|
|
| |
40 |
|
|
| |
41 |
|
|
| |
42 |
40 |
public: |
| |
43 |
41 |
TSmartPath TransformPath( |
| |
44 |
42 |
IFilesystemPtr spFilesystem, |
| |
45 |
43 |
TSmartPath pathSrcBase, |
| |
46 |
44 |
TSmartPath pathSrcRelativeToBase, |
| |
|
45 |
TSmartPath pathBaseDstOverride, |
| |
|
46 |
TSmartPath pathDstOverride, |
| |
47 |
47 |
bool bSrcIsFile, |
| |
48 |
48 |
TSmartPath pathDst, |
| |
49 |
49 |
bool bIgnoreFolders, |
| |
50 |
50 |
bool bForceDirectories |
| |
51 |
51 |
) |
| |
52 |
52 |
{ |
| |
53 |
53 |
TString strFirstAltName = L"Copy of %name"; |
| |
54 |
54 |
TString strNextAltName = L"Copy (%count) of %name"; |
| |
55 |
55 |
|
| |
56 |
56 |
TBasePathDataPtr spBasePath(new TBasePathData(0, pathSrcBase)); |
| |
|
57 |
spBasePath->SetDestinationPath(pathBaseDstOverride); |
| |
57 |
58 |
TFileInfoPtr spFileInfo(new TFileInfo(spBasePath, pathSrcRelativeToBase, bSrcIsFile ? FILE_ATTRIBUTE_NORMAL : FILE_ATTRIBUTE_DIRECTORY, |
| |
58 |
59 |
0, TFileTime(), TFileTime(), TFileTime(), 0)); |
| |
|
60 |
spFileInfo->SetDstRelativePath(pathDstOverride); |
| |
59 |
61 |
|
| |
60 |
62 |
TDestinationPathProvider tDstPathProvider(spFilesystem, pathDst, bIgnoreFolders, bForceDirectories, strFirstAltName, strNextAltName); |
| |
61 |
63 |
return tDstPathProvider.CalculateDestinationPath(spFileInfo); |
| |
62 |
64 |
} |
| |
63 |
65 |
}; |
| |
64 |
66 |
|
| |
65 |
67 |
|
| |
66 |
|
INSTANTIATE_TEST_CASE_P(BasicTransformTests, TransformTest, ::testing::Values( |
| |
|
68 |
INSTANTIATE_TEST_CASE_P(TransformTests_NoDstOverride, TransformTest, ::testing::Values( |
| |
67 |
69 |
|
| |
68 |
70 |
|
| |
69 |
|
std::make_tuple(TString(L"c:"), TString(L"c:"), false, TString(L"x:\\"), false, false, TString(L"x:\\c")), |
| |
70 |
|
std::make_tuple(TString(L"c:\\"), TString(L"c:\\"), false, TString(L"x:\\"), false, false, TString(L"x:\\c")), |
| |
|
71 |
std::make_tuple(L"c:", L"c:", L"", L"", false, L"x:\\", false, false, L"x:\\c"), |
| |
|
72 |
std::make_tuple(L"c:\\", L"c:\\", L"", L"", false, L"x:\\", false, false, L"x:\\c"), |
| |
71 |
73 |
|
| |
72 |
|
std::make_tuple(TString(L"c:"), TString(L"c:"), false, TString(L"x:\\"), true, false, TString(L"x:\\c")), |
| |
73 |
|
std::make_tuple(TString(L"c:\\"), TString(L"c:\\"), false, TString(L"x:\\"), true, false, TString(L"x:\\c")), |
| |
|
74 |
std::make_tuple(L"c:", L"c:", L"", L"", false, L"x:\\", true, false, L"x:\\c"), |
| |
|
75 |
std::make_tuple(L"c:\\", L"c:\\", L"", L"", false, L"x:\\", true, false, L"x:\\c"), |
| |
74 |
76 |
|
| |
75 |
|
std::make_tuple(TString(L"c:"), TString(L"c:"), false, TString(L"x:\\"), false, true, TString(L"x:\\c")), |
| |
76 |
|
std::make_tuple(TString(L"c:\\"), TString(L"c:\\"), false, TString(L"x:\\"), false, true, TString(L"x:\\c")), |
| |
|
77 |
std::make_tuple(L"c:", L"c:", L"", L"", false, L"x:\\", false, true, L"x:\\c"), |
| |
|
78 |
std::make_tuple(L"c:\\", L"c:\\", L"", L"", false, L"x:\\", false, true, L"x:\\c"), |
| |
77 |
79 |
|
| |
78 |
80 |
|
| |
79 |
81 |
|
| |
80 |
|
std::make_tuple(TString(L"c:"), TString(L"c:\\folder\\file.txt"), true, TString(L"x:\\"), false, false, TString(L"x:\\c\\folder\\file.txt")), |
| |
81 |
|
std::make_tuple(TString(L"c:\\"), TString(L"c:\\folder\\file.txt"), true, TString(L"x:\\"), false, false, TString(L"x:\\c\\folder\\file.txt")), |
| |
|
82 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"", L"", true, L"x:\\", false, false, L"x:\\c\\folder\\file.txt"), |
| |
|
83 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"", L"", true, L"x:\\", false, false, L"x:\\c\\folder\\file.txt"), |
| |
82 |
84 |
|
| |
83 |
|
std::make_tuple(TString(L"c:"), TString(L"c:\\folder\\file.txt"), true, TString(L"x:\\"), true, false, TString(L"x:\\file.txt")), |
| |
84 |
|
std::make_tuple(TString(L"c:\\"), TString(L"c:\\folder\\file.txt"), true, TString(L"x:\\"), true, false, TString(L"x:\\file.txt")), |
| |
|
85 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"", L"", true, L"x:\\", true, false, L"x:\\file.txt"), |
| |
|
86 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"", L"", true, L"x:\\", true, false, L"x:\\file.txt"), |
| |
85 |
87 |
|
| |
86 |
|
std::make_tuple(TString(L"c:"), TString(L"c:\\folder\\file.txt"), true, TString(L"x:\\"), false, true, TString(L"x:\\c\\folder\\file.txt")), |
| |
87 |
|
std::make_tuple(TString(L"c:\\"), TString(L"c:\\folder\\file.txt"), true, TString(L"x:\\"), false, true, TString(L"x:\\c\\folder\\file.txt")), |
| |
|
88 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"", L"", true, L"x:\\", false, true, L"x:\\c\\folder\\file.txt"), |
| |
|
89 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"", L"", true, L"x:\\", false, true, L"x:\\c\\folder\\file.txt"), |
| |
88 |
90 |
|
| |
89 |
91 |
|
| |
90 |
92 |
|
| |
91 |
|
std::make_tuple(TString(L"c:\\folder"), TString(L"c:\\folder"), false, TString(L"x:\\"), false, false, TString(L"x:\\folder")), |
| |
92 |
|
std::make_tuple(TString(L"c:\\folder\\"), TString(L"c:\\folder\\"), false, TString(L"x:\\"), false, false, TString(L"x:\\folder")), |
| |
|
93 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"", L"", false, L"x:\\", false, false, L"x:\\folder"), |
| |
|
94 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"", L"", false, L"x:\\", false, false, L"x:\\folder"), |
| |
93 |
95 |
|
| |
94 |
|
std::make_tuple(TString(L"c:\\folder"), TString(L"c:\\folder"), false, TString(L"x:\\"), true, false, TString(L"x:\\folder")), |
| |
95 |
|
std::make_tuple(TString(L"c:\\folder\\"), TString(L"c:\\folder\\"), false, TString(L"x:\\"), true, false, TString(L"x:\\folder")), |
| |
|
96 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"", L"", false, L"x:\\", true, false, L"x:\\folder"), |
| |
|
97 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"", L"", false, L"x:\\", true, false, L"x:\\folder"), |
| |
96 |
98 |
|
| |
97 |
|
std::make_tuple(TString(L"c:\\folder"), TString(L"c:\\folder"), false, TString(L"x:\\"), false, true, TString(L"x:\\c\\folder")), |
| |
98 |
|
std::make_tuple(TString(L"c:\\folder\\"), TString(L"c:\\folder\\"), false, TString(L"x:\\"), false, true, TString(L"x:\\c\\folder")), |
| |
|
99 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"", L"", false, L"x:\\", false, true, L"x:\\c\\folder"), |
| |
|
100 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"", L"", false, L"x:\\", false, true, L"x:\\c\\folder"), |
| |
99 |
101 |
|
| |
100 |
102 |
|
| |
101 |
103 |
|
| |
102 |
|
std::make_tuple(TString(L"c:\\folder"), TString(L"c:\\folder\\folder2\\file.txt"), true, TString(L"x:\\"), false, false, TString(L"x:\\folder\\folder2\\file.txt")), |
| |
103 |
|
std::make_tuple(TString(L"c:\\folder\\"), TString(L"c:\\folder\\folder2\\file.txt"), true, TString(L"x:\\"), false, false, TString(L"x:\\folder\\folder2\\file.txt")), |
| |
|
104 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"", L"", true, L"x:\\", false, false, L"x:\\folder\\folder2\\file.txt"), |
| |
|
105 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"", L"", true, L"x:\\", false, false, L"x:\\folder\\folder2\\file.txt"), |
| |
104 |
106 |
|
| |
105 |
|
std::make_tuple(TString(L"c:\\folder"), TString(L"c:\\folder\\folder2\\file.txt"), true, TString(L"x:\\"), true, false, TString(L"x:\\file.txt")), |
| |
106 |
|
std::make_tuple(TString(L"c:\\folder\\"), TString(L"c:\\folder\\folder2\\file.txt"), true, TString(L"x:\\"), true, false, TString(L"x:\\file.txt")), |
| |
|
107 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"", L"", true, L"x:\\", true, false, L"x:\\file.txt"), |
| |
|
108 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"", L"", true, L"x:\\", true, false, L"x:\\file.txt"), |
| |
107 |
109 |
|
| |
108 |
|
std::make_tuple(TString(L"c:\\folder"), TString(L"c:\\folder\\folder2\\file.txt"), true, TString(L"x:\\"), false, true, TString(L"x:\\c\\folder\\folder2\\file.txt")), |
| |
109 |
|
std::make_tuple(TString(L"c:\\folder\\"), TString(L"c:\\folder\\folder2\\file.txt"), true, TString(L"x:\\"), false, true, TString(L"x:\\c\\folder\\folder2\\file.txt")), |
| |
|
110 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"", L"", true, L"x:\\", false, true, L"x:\\c\\folder\\folder2\\file.txt"), |
| |
|
111 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"", L"", true, L"x:\\", false, true, L"x:\\c\\folder\\folder2\\file.txt"), |
| |
110 |
112 |
|
| |
111 |
113 |
|
| |
112 |
114 |
|
| |
113 |
115 |
|
| |
114 |
|
std::make_tuple(TString(L"c:\\folder\\"), TString(L"c:\\folder"), false, TString(L"x:\\"), false, false, TString(L"x:\\folder")), |
| |
|
116 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder", L"", L"", false, L"x:\\", false, false, L"x:\\folder"), |
| |
115 |
117 |
|
| |
116 |
118 |
|
| |
117 |
|
std::make_tuple(TString(L"c:\\Folder"), TString(L"c:\\folder"), false, TString(L"x:\\"), false, false, TString(L"x:\\Folder")) |
| |
|
119 |
std::make_tuple(L"c:\\Folder", L"c:\\folder", L"", L"", false, L"x:\\", false, false, L"x:\\Folder") |
| |
118 |
120 |
)); |
| |
119 |
121 |
|
| |
|
122 |
|
| |
|
123 |
|
| |
|
124 |
INSTANTIATE_TEST_CASE_P(TransformTests_TopLevelOverride, TransformTest, ::testing::Values( |
| |
|
125 |
|
| |
|
126 |
|
| |
|
127 |
std::make_tuple(L"c:", L"c:", L"AltTL", L"", false, L"x:\\", false, false, L"x:\\AltTL"), |
| |
|
128 |
std::make_tuple(L"c:\\", L"c:\\", L"AltTL", L"", false, L"x:\\", false, false, L"x:\\AltTL"), |
| |
|
129 |
|
| |
|
130 |
std::make_tuple(L"c:", L"c:", L"AltTL", L"", false, L"x:\\", true, false, L"x:\\c"), |
| |
|
131 |
std::make_tuple(L"c:\\", L"c:\\", L"AltTL", L"", false, L"x:\\", true, false, L"x:\\c"), |
| |
|
132 |
|
| |
|
133 |
std::make_tuple(L"c:", L"c:", L"AltTL", L"", false, L"x:\\", false, true, L"x:\\c"), |
| |
|
134 |
std::make_tuple(L"c:\\", L"c:\\", L"AltTL", L"", false, L"x:\\", false, true, L"x:\\c"), |
| |
|
135 |
|
| |
|
136 |
|
| |
|
137 |
|
| |
|
138 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"AltTL", L"", true, L"x:\\", false, false, L"x:\\AltTL\\folder\\file.txt"), |
| |
|
139 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"AltTL", L"", true, L"x:\\", false, false, L"x:\\AltTL\\folder\\file.txt"), |
| |
|
140 |
|
| |
|
141 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"AltTL", L"", true, L"x:\\", true, false, L"x:\\file.txt"), |
| |
|
142 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"AltTL", L"", true, L"x:\\", true, false, L"x:\\file.txt"), |
| |
|
143 |
|
| |
|
144 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"AltTL", L"", true, L"x:\\", false, true, L"x:\\c\\folder\\file.txt"), |
| |
|
145 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"AltTL", L"", true, L"x:\\", false, true, L"x:\\c\\folder\\file.txt"), |
| |
|
146 |
|
| |
|
147 |
|
| |
|
148 |
|
| |
|
149 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"AltTL", L"", false, L"x:\\", false, false, L"x:\\AltTL"), |
| |
|
150 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"AltTL", L"", false, L"x:\\", false, false, L"x:\\AltTL"), |
| |
|
151 |
|
| |
|
152 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"AltTL", L"", false, L"x:\\", true, false, L"x:\\folder"), |
| |
|
153 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"AltTL", L"", false, L"x:\\", true, false, L"x:\\folder"), |
| |
|
154 |
|
| |
|
155 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"AltTL", L"", false, L"x:\\", false, true, L"x:\\c\\folder"), |
| |
|
156 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"AltTL", L"", false, L"x:\\", false, true, L"x:\\c\\folder"), |
| |
|
157 |
|
| |
|
158 |
|
| |
|
159 |
|
| |
|
160 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"", true, L"x:\\", false, false, L"x:\\AltTL\\folder2\\file.txt"), |
| |
|
161 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"", true, L"x:\\", false, false, L"x:\\AltTL\\folder2\\file.txt"), |
| |
|
162 |
|
| |
|
163 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"", true, L"x:\\", true, false, L"x:\\file.txt"), |
| |
|
164 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"", true, L"x:\\", true, false, L"x:\\file.txt"), |
| |
|
165 |
|
| |
|
166 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"", true, L"x:\\", false, true, L"x:\\c\\folder\\folder2\\file.txt"), |
| |
|
167 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"", true, L"x:\\", false, true, L"x:\\c\\folder\\folder2\\file.txt"), |
| |
|
168 |
|
| |
|
169 |
|
| |
|
170 |
|
| |
|
171 |
|
| |
|
172 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder", L"AltTL", L"", false, L"x:\\", false, false, L"x:\\AltTL"), |
| |
|
173 |
|
| |
|
174 |
|
| |
|
175 |
std::make_tuple(L"c:\\Folder", L"c:\\folder", L"AltTL", L"", false, L"x:\\", false, false, L"x:\\AltTL") |
| |
|
176 |
)); |
| |
|
177 |
|
| |
|
178 |
INSTANTIATE_TEST_CASE_P(TransformTests_DstOverride, TransformTest, ::testing::Values( |
| |
|
179 |
|
| |
|
180 |
|
| |
|
181 |
std::make_tuple(L"c:", L"c:", L"", L"AltName", false, L"x:\\", false, false, L"x:\\AltName"), |
| |
|
182 |
std::make_tuple(L"c:\\", L"c:\\", L"", L"AltName", false, L"x:\\", false, false, L"x:\\AltName"), |
| |
|
183 |
|
| |
|
184 |
std::make_tuple(L"c:", L"c:", L"", L"AltName", false, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
185 |
std::make_tuple(L"c:\\", L"c:\\", L"", L"AltName", false, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
186 |
|
| |
|
187 |
std::make_tuple(L"c:", L"c:", L"", L"AltName", false, L"x:\\", false, true, L"x:\\AltName"), |
| |
|
188 |
std::make_tuple(L"c:\\", L"c:\\", L"", L"AltName", false, L"x:\\", false, true, L"x:\\AltName"), |
| |
|
189 |
|
| |
|
190 |
|
| |
|
191 |
|
| |
|
192 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"", L"AltName", true, L"x:\\", false, false, L"x:\\c\\folder\\AltName"), |
| |
|
193 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"", L"AltName", true, L"x:\\", false, false, L"x:\\c\\folder\\AltName"), |
| |
|
194 |
|
| |
|
195 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"", L"AltName", true, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
196 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"", L"AltName", true, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
197 |
|
| |
|
198 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"", L"AltName", true, L"x:\\", false, true, L"x:\\c\\folder\\AltName"), |
| |
|
199 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"", L"AltName", true, L"x:\\", false, true, L"x:\\c\\folder\\AltName"), |
| |
|
200 |
|
| |
|
201 |
|
| |
|
202 |
|
| |
|
203 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"", L"AltName", false, L"x:\\", false, false, L"x:\\AltName"), |
| |
|
204 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"", L"AltName", false, L"x:\\", false, false, L"x:\\AltName"), |
| |
|
205 |
|
| |
|
206 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"", L"AltName", false, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
207 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"", L"AltName", false, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
208 |
|
| |
|
209 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"", L"AltName", false, L"x:\\", false, true, L"x:\\c\\AltName"), |
| |
|
210 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"", L"AltName", false, L"x:\\", false, true, L"x:\\c\\AltName"), |
| |
|
211 |
|
| |
|
212 |
|
| |
|
213 |
|
| |
|
214 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"", L"AltName", true, L"x:\\", false, false, L"x:\\folder\\folder2\\AltName"), |
| |
|
215 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"", L"AltName", true, L"x:\\", false, false, L"x:\\folder\\folder2\\AltName"), |
| |
|
216 |
|
| |
|
217 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"", L"AltName", true, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
218 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"", L"AltName", true, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
219 |
|
| |
|
220 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"", L"AltName", true, L"x:\\", false, true, L"x:\\c\\folder\\folder2\\AltName"), |
| |
|
221 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"", L"AltName", true, L"x:\\", false, true, L"x:\\c\\folder\\folder2\\AltName"), |
| |
|
222 |
|
| |
|
223 |
|
| |
|
224 |
|
| |
|
225 |
|
| |
|
226 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder", L"", L"AltName", false, L"x:\\", false, false, L"x:\\AltName"), |
| |
|
227 |
|
| |
|
228 |
|
| |
|
229 |
std::make_tuple(L"c:\\Folder", L"c:\\folder", L"", L"AltName", false, L"x:\\", false, false, L"x:\\AltName") |
| |
|
230 |
)); |
| |
|
231 |
|
| |
|
232 |
INSTANTIATE_TEST_CASE_P(TransformTests_TopLevelOverrideAndDstOverride, TransformTest, ::testing::Values( |
| |
|
233 |
|
| |
|
234 |
|
| |
|
235 |
std::make_tuple(L"c:", L"c:", L"AltTL", L"AltName", false, L"x:\\", false, false, L"x:\\AltName"), |
| |
|
236 |
std::make_tuple(L"c:\\", L"c:\\", L"AltTL", L"AltName", false, L"x:\\", false, false, L"x:\\AltName"), |
| |
|
237 |
|
| |
|
238 |
std::make_tuple(L"c:", L"c:", L"AltTL", L"AltName", false, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
239 |
std::make_tuple(L"c:\\", L"c:\\", L"AltTL", L"AltName", false, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
240 |
|
| |
|
241 |
std::make_tuple(L"c:", L"c:", L"AltTL", L"AltName", false, L"x:\\", false, true, L"x:\\AltName"), |
| |
|
242 |
std::make_tuple(L"c:\\", L"c:\\", L"AltTL", L"AltName", false, L"x:\\", false, true, L"x:\\AltName"), |
| |
|
243 |
|
| |
|
244 |
|
| |
|
245 |
|
| |
|
246 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"AltTL", L"AltName", true, L"x:\\", false, false, L"x:\\AltTL\\folder\\AltName"), |
| |
|
247 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"AltTL", L"AltName", true, L"x:\\", false, false, L"x:\\AltTL\\folder\\AltName"), |
| |
|
248 |
|
| |
|
249 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"AltTL", L"AltName", true, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
250 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"AltTL", L"AltName", true, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
251 |
|
| |
|
252 |
std::make_tuple(L"c:", L"c:\\folder\\file.txt", L"AltTL", L"AltName", true, L"x:\\", false, true, L"x:\\c\\folder\\AltName"), |
| |
|
253 |
std::make_tuple(L"c:\\", L"c:\\folder\\file.txt", L"AltTL", L"AltName", true, L"x:\\", false, true, L"x:\\c\\folder\\AltName"), |
| |
|
254 |
|
| |
|
255 |
|
| |
|
256 |
|
| |
|
257 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"AltTL", L"AltName", false, L"x:\\", false, false, L"x:\\AltName"), |
| |
|
258 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"AltTL", L"AltName", false, L"x:\\", false, false, L"x:\\AltName"), |
| |
|
259 |
|
| |
|
260 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"AltTL", L"AltName", false, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
261 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"AltTL", L"AltName", false, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
262 |
|
| |
|
263 |
std::make_tuple(L"c:\\folder", L"c:\\folder", L"AltTL", L"AltName", false, L"x:\\", false, true, L"x:\\c\\AltName"), |
| |
|
264 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\", L"AltTL", L"AltName", false, L"x:\\", false, true, L"x:\\c\\AltName"), |
| |
|
265 |
|
| |
|
266 |
|
| |
|
267 |
|
| |
|
268 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"AltName", true, L"x:\\", false, false, L"x:\\AltTL\\folder2\\AltName"), |
| |
|
269 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"AltName", true, L"x:\\", false, false, L"x:\\AltTL\\folder2\\AltName"), |
| |
|
270 |
|
| |
|
271 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"AltName", true, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
272 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"AltName", true, L"x:\\", true, false, L"x:\\AltName"), |
| |
|
273 |
|
| |
|
274 |
std::make_tuple(L"c:\\folder", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"AltName", true, L"x:\\", false, true, L"x:\\c\\folder\\folder2\\AltName"), |
| |
|
275 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder\\folder2\\file.txt", L"AltTL", L"AltName", true, L"x:\\", false, true, L"x:\\c\\folder\\folder2\\AltName"), |
| |
|
276 |
|
| |
|
277 |
|
| |
|
278 |
|
| |
|
279 |
|
| |
|
280 |
std::make_tuple(L"c:\\folder\\", L"c:\\folder", L"AltTL", L"AltName", false, L"x:\\", false, false, L"x:\\AltName"), |
| |
|
281 |
|
| |
|
282 |
|
| |
|
283 |
std::make_tuple(L"c:\\Folder", L"c:\\folder", L"AltTL", L"AltName", false, L"x:\\", false, false, L"x:\\AltName") |
| |
|
284 |
)); |
| |
|
285 |
|
| |
120 |
286 |
TEST_P(TransformTest, PathTest) |
| |
121 |
287 |
{ |
| |
122 |
288 |
const TestTuple& rTestData = GetParam(); |
| |
123 |
289 |
|
| |
124 |
290 |
|
| |
125 |
|
TSmartPath pathSrcBase = PathFromWString(std::get<0>(rTestData)); |
| |
126 |
|
TSmartPath pathSrcRelativeToBase = PathFromWString(std::get<1>(rTestData)); |
| |
127 |
|
bool bSrcIsFile = std::get<2>(rTestData); |
| |
128 |
|
TSmartPath pathDst = PathFromWString(std::get<3>(rTestData)); |
| |
129 |
|
TString strExpectedResultPath = std::get<6>(rTestData); |
| |
|
291 |
TSmartPath pathSrcBase = PathFromString(std::get<0>(rTestData)); |
| |
|
292 |
TSmartPath pathSrcRelativeToBase = PathFromString(std::get<1>(rTestData)); |
| |
|
293 |
TSmartPath pathBaseDstOverride = PathFromString(std::get<2>(rTestData)); |
| |
|
294 |
TSmartPath pathDstOverride = PathFromString(std::get<3>(rTestData)); |
| |
|
295 |
bool bSrcIsFile = std::get<4>(rTestData); |
| |
|
296 |
TSmartPath pathDst = PathFromString(std::get<5>(rTestData)); |
| |
|
297 |
TString strExpectedResultPath = std::get<8>(rTestData); |
| |
130 |
298 |
|
| |
131 |
|
bool bIgnoreFolders = std::get<4>(rTestData); |
| |
132 |
|
bool bForceDirectories = std::get<5>(rTestData); |
| |
|
299 |
bool bIgnoreFolders = std::get<6>(rTestData); |
| |
|
300 |
bool bForceDirectories = std::get<7>(rTestData); |
| |
133 |
301 |
|
| |
134 |
302 |
|
| |
135 |
303 |
std::shared_ptr<NiceMock<IFilesystemMock> > spFilesystemMock(new NiceMock<IFilesystemMock>); |
| |
136 |
304 |
EXPECT_CALL(*spFilesystemMock, PathExist(_)) |
| |
137 |
305 |
.WillRepeatedly(Return(false)); |
| |
138 |
306 |
|
| |
139 |
307 |
|
| |
140 |
308 |
TSmartPath pathResult = TransformPath(spFilesystemMock, |
| |
141 |
309 |
pathSrcBase, |
| |
142 |
310 |
pathSrcRelativeToBase, |
| |
|
311 |
pathBaseDstOverride, |
| |
|
312 |
pathDstOverride, |
| |
143 |
313 |
bSrcIsFile, |
| |
144 |
314 |
pathDst, |
| |
145 |
315 |
bIgnoreFolders, |
| |
146 |
316 |
bForceDirectories); |
| |
147 |
317 |
|
| |
148 |
318 |
|
| |
149 |
319 |
ASSERT_STREQ(strExpectedResultPath.c_str(), pathResult.ToString()); |
| |
150 |
320 |
} |
|