25
25
#include < test/TemporaryDirectory.h>
26
26
#include < test/libsolidity/util/SoltestErrors.h>
27
27
28
+ #include < boost/algorithm/string.hpp>
28
29
#include < boost/filesystem.hpp>
29
30
#include < boost/test/unit_test.hpp>
30
31
@@ -192,8 +193,8 @@ BOOST_AUTO_TEST_CASE(normalizeCLIPathForVFS_root_name_only)
192
193
193
194
#if defined(_WIN32)
194
195
boost::filesystem::path driveLetter = boost::filesystem::current_path ().root_name ();
195
- solAssert (!driveLetter.empty (), " " );
196
- solAssert (driveLetter.is_relative (), " " );
196
+ soltestAssert (!driveLetter.empty (), " " );
197
+ soltestAssert (driveLetter.is_relative (), " " );
197
198
198
199
BOOST_CHECK_EQUAL (FileReader::normalizeCLIPathForVFS (driveLetter, resolveSymlinks), expectedWorkDir);
199
200
#endif
@@ -212,13 +213,32 @@ BOOST_AUTO_TEST_CASE(normalizeCLIPathForVFS_stripping_root_name)
212
213
213
214
for (SymlinkResolution resolveSymlinks: {SymlinkResolution::Enabled, SymlinkResolution::Disabled})
214
215
{
216
+ boost::filesystem::path workDir = boost::filesystem::current_path ();
217
+
215
218
boost::filesystem::path normalizedPath = FileReader::normalizeCLIPathForVFS (
216
- boost::filesystem::current_path () ,
219
+ workDir ,
217
220
resolveSymlinks
218
221
);
219
- BOOST_CHECK_EQUAL (normalizedPath, " /" / boost::filesystem::current_path () .relative_path ());
222
+ BOOST_CHECK_EQUAL (normalizedPath, " /" / workDir .relative_path ());
220
223
BOOST_TEST (normalizedPath.root_name ().empty ());
221
224
BOOST_CHECK_EQUAL (normalizedPath.root_directory (), " /" );
225
+
226
+ #if defined(_WIN32)
227
+ string root = workDir.root_path ().string ();
228
+ soltestAssert (root.length () == 3 && root[1 ] == ' :' && root[2 ] == ' \\ ' , " " );
229
+
230
+ for (auto convert: {boost::to_lower_copy<string>, boost::to_upper_copy<string>})
231
+ {
232
+ boost::filesystem::path workDirWin = convert (root, locale ()) / workDir.relative_path ();
233
+ normalizedPath = FileReader::normalizeCLIPathForVFS (
234
+ workDirWin,
235
+ resolveSymlinks
236
+ );
237
+ BOOST_CHECK_EQUAL (normalizedPath, " /" / workDir.relative_path ());
238
+ BOOST_TEST (normalizedPath.root_name ().empty ());
239
+ BOOST_CHECK_EQUAL (normalizedPath.root_directory (), " /" );
240
+ }
241
+ #endif
222
242
}
223
243
}
224
244
0 commit comments