aboutsummaryrefslogtreecommitdiff
path: root/src/libs/dutil/test/DUtilUnitTest
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-06-03 17:48:39 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-06-07 19:44:36 -0500
commit6b0f2d978504da82070523eb6adb0b59f9812e93 (patch)
tree6f0b258519a0f51bf589e4313206b3ffeaa32a41 /src/libs/dutil/test/DUtilUnitTest
parentb652e93a460b4b822a01382e5992f96f1d805ffe (diff)
downloadwix-6b0f2d978504da82070523eb6adb0b59f9812e93.tar.gz
wix-6b0f2d978504da82070523eb6adb0b59f9812e93.tar.bz2
wix-6b0f2d978504da82070523eb6adb0b59f9812e93.zip
Add PathSkipPastRoot.
Diffstat (limited to 'src/libs/dutil/test/DUtilUnitTest')
-rw-r--r--src/libs/dutil/test/DUtilUnitTest/PathUtilTest.cpp288
1 files changed, 153 insertions, 135 deletions
diff --git a/src/libs/dutil/test/DUtilUnitTest/PathUtilTest.cpp b/src/libs/dutil/test/DUtilUnitTest/PathUtilTest.cpp
index 2505c6bf..d1d304d3 100644
--- a/src/libs/dutil/test/DUtilUnitTest/PathUtilTest.cpp
+++ b/src/libs/dutil/test/DUtilUnitTest/PathUtilTest.cpp
@@ -135,14 +135,22 @@ namespace DutilTests
135 NativeAssert::Succeeded(hr, "Failed to canonicalize path"); 135 NativeAssert::Succeeded(hr, "Failed to canonicalize path");
136 NativeAssert::StringEqual(L"\\\\server\\share\\", sczCanonicalized); 136 NativeAssert::StringEqual(L"\\\\server\\share\\", sczCanonicalized);
137 137
138 hr = PathCanonicalizeForComparison(L"\\\\.\\share\\otherdir\\unc.exe", PATH_CANONICALIZE_KEEP_UNC_ROOT, &sczCanonicalized); 138 hr = PathCanonicalizeForComparison(L"\\\\.\\UNC\\server\\share\\..\\unc.exe", PATH_CANONICALIZE_KEEP_UNC_ROOT, &sczCanonicalized);
139 NativeAssert::Succeeded(hr, "Failed to canonicalize path"); 139 NativeAssert::Succeeded(hr, "Failed to canonicalize path");
140 NativeAssert::StringEqual(L"\\\\.\\share\\otherdir\\unc.exe", sczCanonicalized); 140 NativeAssert::StringEqual(L"\\\\?\\UNC\\server\\share\\unc.exe", sczCanonicalized);
141 141
142 hr = PathCanonicalizeForComparison(L"\\\\.\\share\\otherdir\\unc.exe", 0, &sczCanonicalized); 142 hr = PathCanonicalizeForComparison(L"\\\\..\\share\\otherdir\\unc.exe", PATH_CANONICALIZE_KEEP_UNC_ROOT, &sczCanonicalized);
143 NativeAssert::Succeeded(hr, "Failed to canonicalize path");
144 NativeAssert::StringEqual(L"\\\\..\\share\\otherdir\\unc.exe", sczCanonicalized);
145
146 hr = PathCanonicalizeForComparison(L"\\\\..\\share\\otherdir\\unc.exe", 0, &sczCanonicalized);
143 NativeAssert::Succeeded(hr, "Failed to canonicalize path"); 147 NativeAssert::Succeeded(hr, "Failed to canonicalize path");
144 NativeAssert::StringEqual(L"\\\\share\\otherdir\\unc.exe", sczCanonicalized); 148 NativeAssert::StringEqual(L"\\\\share\\otherdir\\unc.exe", sczCanonicalized);
145 149
150 hr = PathCanonicalizeForComparison(L"\\\\.\\UNC\\share\\otherdir\\unc.exe", 0, &sczCanonicalized);
151 NativeAssert::Succeeded(hr, "Failed to canonicalize path");
152 NativeAssert::StringEqual(L"\\\\UNC\\share\\otherdir\\unc.exe", sczCanonicalized);
153
146 hr = PathCanonicalizeForComparison(L"\\\\server\\share\\..\\..\\otherdir\\unc.exe", PATH_CANONICALIZE_KEEP_UNC_ROOT, &sczCanonicalized); 154 hr = PathCanonicalizeForComparison(L"\\\\server\\share\\..\\..\\otherdir\\unc.exe", PATH_CANONICALIZE_KEEP_UNC_ROOT, &sczCanonicalized);
147 NativeAssert::Succeeded(hr, "Failed to canonicalize path"); 155 NativeAssert::Succeeded(hr, "Failed to canonicalize path");
148 NativeAssert::StringEqual(L"\\\\server\\share\\otherdir\\unc.exe", sczCanonicalized); 156 NativeAssert::StringEqual(L"\\\\server\\share\\otherdir\\unc.exe", sczCanonicalized);
@@ -215,7 +223,7 @@ namespace DutilTests
215 NativeAssert::Succeeded(hr, "Failed to canonicalize path"); 223 NativeAssert::Succeeded(hr, "Failed to canonicalize path");
216 NativeAssert::StringEqual(L"C:\\invalid:pathchars?.exe", sczCanonicalized); 224 NativeAssert::StringEqual(L"C:\\invalid:pathchars?.exe", sczCanonicalized);
217 225
218 hr = PathCanonicalizeForComparison(L"C:\\addprefix.exe", PATH_CANONICALIZE_APPEND_LONG_PATH_PREFIX, &sczCanonicalized); 226 hr = PathCanonicalizeForComparison(L"C:\\addprefix.exe", PATH_CANONICALIZE_APPEND_EXTENDED_PATH_PREFIX, &sczCanonicalized);
219 NativeAssert::Succeeded(hr, "Failed to canonicalize path"); 227 NativeAssert::Succeeded(hr, "Failed to canonicalize path");
220 NativeAssert::StringEqual(L"\\\\?\\C:\\addprefix.exe", sczCanonicalized); 228 NativeAssert::StringEqual(L"\\\\?\\C:\\addprefix.exe", sczCanonicalized);
221 229
@@ -312,7 +320,7 @@ namespace DutilTests
312 LPCWSTR rgwzPaths[8] = 320 LPCWSTR rgwzPaths[8] =
313 { 321 {
314 L"C:\\simplepath", L"D:\\simplepath", 322 L"C:\\simplepath", L"D:\\simplepath",
315 L"\\\\.\\share\\otherdir\\unc.exe", L"\\\\share\\otherdir\\unc.exe", 323 L"\\\\..\\share\\otherdir\\unc.exe", L"\\\\share\\otherdir\\unc.exe",
316 L"\\\\server\\.\\otherdir\\unc.exe", L"\\\\server\\otherdir\\unc.exe", 324 L"\\\\server\\.\\otherdir\\unc.exe", L"\\\\server\\otherdir\\unc.exe",
317 L"\\\\server\\\\otherdir\\unc.exe", L"\\\\server\\otherdir\\unc.exe", 325 L"\\\\server\\\\otherdir\\unc.exe", L"\\\\server\\otherdir\\unc.exe",
318 }; 326 };
@@ -541,9 +549,10 @@ namespace DutilTests
541 { 549 {
542 HRESULT hr = S_OK; 550 HRESULT hr = S_OK;
543 LPWSTR sczPath = NULL; 551 LPWSTR sczPath = NULL;
544 LPCWSTR rgwzPaths[18] = 552 LPCWSTR rgwzPaths[20] =
545 { 553 {
546 L"C:\\a\\b", L"C:\\a\\", 554 L"C:\\a\\b", L"C:\\a\\",
555 L"C:\\a\\b\\", L"C:\\a\\b\\",
547 L"C:\\a", L"C:\\", 556 L"C:\\a", L"C:\\",
548 L"C:\\", L"C:\\", 557 L"C:\\", L"C:\\",
549 L"\"C:\\a\\b\\c\"", L"\"C:\\a\\b\\", 558 L"\"C:\\a\\b\\c\"", L"\"C:\\a\\b\\",
@@ -570,6 +579,40 @@ namespace DutilTests
570 } 579 }
571 580
572 [Fact] 581 [Fact]
582 void PathGetParentPathTest()
583 {
584 HRESULT hr = S_OK;
585 LPWSTR sczPath = NULL;
586 LPCWSTR rgwzPaths[20] =
587 {
588 L"C:\\a\\b", L"C:\\a\\",
589 L"C:\\a\\b\\", L"C:\\a\\",
590 L"C:\\a", L"C:\\",
591 L"C:\\", NULL,
592 L"\"C:\\a\\b\\c\"", L"\"C:\\a\\b\\",
593 L"\"C:\\a\\b\\\"c", L"\"C:\\a\\b\\",
594 L"\"C:\\a\\b\"\\c", L"\"C:\\a\\b\"\\",
595 L"\"C:\\a\\\"b\\c", L"\"C:\\a\\\"b\\",
596 L"C:\\a\"\\\"b\\c", L"C:\\a\"\\\"b\\",
597 L"C:\\a\"\\b\\c\"", L"C:\\a\"\\b\\",
598 };
599
600 try
601 {
602 for (DWORD i = 0; i < countof(rgwzPaths); i += 2)
603 {
604 hr = PathGetParentPath(rgwzPaths[i], &sczPath, NULL);
605 NativeAssert::Succeeded(hr, "PathGetParentPath: {0}", rgwzPaths[i]);
606 NativeAssert::StringEqual(rgwzPaths[i + 1], sczPath);
607 }
608 }
609 finally
610 {
611 ReleaseStr(sczPath);
612 }
613 }
614
615 [Fact]
573 void PathGetFullPathNameTest() 616 void PathGetFullPathNameTest()
574 { 617 {
575 HRESULT hr = S_OK; 618 HRESULT hr = S_OK;
@@ -693,6 +736,12 @@ namespace DutilTests
693 NativeAssert::StringEqual(L"Software\\Microsoft\\Windows\\", rgsczPaths[2]); 736 NativeAssert::StringEqual(L"Software\\Microsoft\\Windows\\", rgsczPaths[2]);
694 ReleaseNullStrArray(rgsczPaths, cPaths); 737 ReleaseNullStrArray(rgsczPaths, cPaths);
695 738
739 hr = PathGetHierarchyArray(L"Software", &rgsczPaths, &cPaths);
740 NativeAssert::Succeeded(hr, "Failed to get parent directories array for relative path");
741 Assert::Equal<DWORD>(1, cPaths);
742 NativeAssert::StringEqual(L"Software", rgsczPaths[0]);
743 ReleaseNullStrArray(rgsczPaths, cPaths);
744
696 hr = PathGetHierarchyArray(L"c:/foo/bar/bas/a.txt", &rgsczPaths, &cPaths); 745 hr = PathGetHierarchyArray(L"c:/foo/bar/bas/a.txt", &rgsczPaths, &cPaths);
697 NativeAssert::Succeeded(hr, "Failed to get parent directories array for regular file path"); 746 NativeAssert::Succeeded(hr, "Failed to get parent directories array for regular file path");
698 Assert::Equal<DWORD>(5, cPaths); 747 Assert::Equal<DWORD>(5, cPaths);
@@ -832,8 +881,12 @@ namespace DutilTests
832 hr = StrAllocString(&sczPath, rgwzPaths[i], 0); 881 hr = StrAllocString(&sczPath, rgwzPaths[i], 0);
833 NativeAssert::Succeeded(hr, "Failed to copy string"); 882 NativeAssert::Succeeded(hr, "Failed to copy string");
834 883
835 hr = PathPrefix(&sczPath); 884 hr = PathPrefix(&sczPath, 0, 0);
836 NativeAssert::Succeeded(hr, "PathPrefix: {0}", rgwzPaths[i]); 885 NativeAssert::Succeeded(hr, "PathPrefix: {0}", rgwzPaths[i]);
886 NativeAssert::StringEqual(rgwzPaths[i], sczPath);
887
888 hr = PathPrefix(&sczPath, 0, PATH_PREFIX_SHORT_PATHS);
889 NativeAssert::Succeeded(hr, "PathPrefix (SHORT_PATHS): {0}", rgwzPaths[i]);
837 NativeAssert::StringEqual(rgwzPaths[i + 1], sczPath); 890 NativeAssert::StringEqual(rgwzPaths[i + 1], sczPath);
838 } 891 }
839 } 892 }
@@ -871,7 +924,7 @@ namespace DutilTests
871 hr = StrAllocString(&sczPath, rgwzPaths[i], 0); 924 hr = StrAllocString(&sczPath, rgwzPaths[i], 0);
872 NativeAssert::Succeeded(hr, "Failed to copy string"); 925 NativeAssert::Succeeded(hr, "Failed to copy string");
873 926
874 hr = PathPrefix(&sczPath); 927 hr = PathPrefix(&sczPath, 0, PATH_PREFIX_EXPECT_FULLY_QUALIFIED);
875 NativeAssert::SpecificReturnCode(E_INVALIDARG, hr, "PathPrefix: {0}, {1}", rgwzPaths[i], sczPath); 928 NativeAssert::SpecificReturnCode(E_INVALIDARG, hr, "PathPrefix: {0}, {1}", rgwzPaths[i], sczPath);
876 } 929 }
877 } 930 }
@@ -884,187 +937,152 @@ namespace DutilTests
884 [Fact] 937 [Fact]
885 void PathIsRootedAndFullyQualifiedTest() 938 void PathIsRootedAndFullyQualifiedTest()
886 { 939 {
887 HRESULT hr = S_OK; 940 LPCWSTR rgwzPaths[30] =
888 LPWSTR sczPath = NULL; 941 {
889 LPCWSTR rgwzPaths[15] = 942 L"//", L"",
890 { 943 L"///", L"",
891 L"//", 944 L"C:/", L"",
892 L"///", 945 L"C://", L"/",
893 L"C:/", 946 L"C:/foo1", L"foo1",
894 L"C://", 947 L"C://foo2", L"/foo2",
895 L"C:/foo1", 948 L"//test/unc/path/to/something", L"path/to/something",
896 L"C://foo2", 949 L"//a/b/c/d/e", L"c/d/e",
897 L"//test/unc/path/to/something", 950 L"//a/b/", L"",
898 L"//a/b/c/d/e", 951 L"//a/b", L"",
899 L"//a/b/", 952 L"//test/unc", L"",
900 L"//a/b", 953 L"//Server", L"",
901 L"//test/unc", 954 L"//Server/Foo.txt", L"",
902 L"//Server", 955 L"//Server/Share/Foo.txt", L"Foo.txt",
903 L"//Server/Foo.txt", 956 L"//Server/Share/Test/Foo.txt", L"Test/Foo.txt",
904 L"//Server/Share/Foo.txt",
905 L"//Server/Share/Test/Foo.txt",
906 }; 957 };
907 958
908 try 959 ValidateSkipPastRoot(rgwzPaths, countof(rgwzPaths), FALSE, TRUE, TRUE);
909 {
910 for (DWORD i = 0; i < countof(rgwzPaths); ++i)
911 {
912 ValidateFullyQualifiedPath(rgwzPaths[i], TRUE, FALSE);
913 ValidateRootedPath(rgwzPaths[i], TRUE);
914
915 hr = StrAllocString(&sczPath, rgwzPaths[i], 0);
916 NativeAssert::Succeeded(hr, "Failed to copy string");
917
918 PathFixedReplaceForwardSlashes(sczPath);
919 ValidateFullyQualifiedPath(sczPath, TRUE, FALSE);
920 ValidateRootedPath(sczPath, TRUE);
921 }
922 }
923 finally
924 {
925 ReleaseStr(sczPath);
926 }
927 } 960 }
928 961
929 [Fact] 962 [Fact]
930 void PathIsRootedAndFullyQualifiedWithPrefixTest() 963 void PathIsRootedAndFullyQualifiedWithPrefixTest()
931 { 964 {
932 HRESULT hr = S_OK; 965 LPCWSTR rgwzPaths[12] =
933 LPWSTR sczPath = NULL;
934 LPCWSTR rgwzPaths[6] =
935 { 966 {
936 L"//?/UNC/test/unc/path/to/something", 967 L"//?/UNC/test/unc/path/to/something", L"path/to/something",
937 L"//?/UNC/test/unc", 968 L"//?/UNC/test/unc", L"",
938 L"//?/UNC/a/b1", 969 L"//?/UNC/a/b1", L"",
939 L"//?/UNC/a/b2/", 970 L"//?/UNC/a/b2/", L"",
940 L"//?/C:/foo/bar.txt", 971 L"//?/C:/foo/bar.txt", L"foo/bar.txt",
941 L"/??/C:/foo/bar.txt", 972 L"/??/C:/foo/bar.txt", L"foo/bar.txt",
942 }; 973 };
943 974
944 try 975 ValidateSkipPastRoot(rgwzPaths, countof(rgwzPaths), TRUE, TRUE, TRUE);
945 {
946 for (DWORD i = 0; i < countof(rgwzPaths); ++i)
947 {
948 ValidateFullyQualifiedPath(rgwzPaths[i], TRUE, TRUE);
949 ValidateRootedPath(rgwzPaths[i], TRUE);
950
951 hr = StrAllocString(&sczPath, rgwzPaths[i], 0);
952 NativeAssert::Succeeded(hr, "Failed to copy string");
953
954 PathFixedReplaceForwardSlashes(sczPath);
955 ValidateFullyQualifiedPath(sczPath, TRUE, TRUE);
956 ValidateRootedPath(sczPath, TRUE);
957 }
958 }
959 finally
960 {
961 ReleaseStr(sczPath);
962 }
963 } 976 }
964 977
965 [Fact] 978 [Fact]
966 void PathIsRootedButNotFullyQualifiedTest() 979 void PathIsRootedButNotFullyQualifiedTest()
967 { 980 {
968 HRESULT hr = S_OK; 981 LPCWSTR rgwzPaths[14] =
969 LPWSTR sczPath = NULL;
970 LPCWSTR rgwzPaths[7] =
971 { 982 {
972 L"/", 983 L"/", L"",
973 L"a:", 984 L"a:", L"",
974 L"A:", 985 L"A:", L"",
975 L"z:", 986 L"z:", L"",
976 L"Z:", 987 L"Z:", L"",
977 L"C:foo.txt", 988 L"C:foo.txt", L"foo.txt",
978 L"/dir", 989 L"/dir", L"dir",
979 }; 990 };
980 991
981 try 992 ValidateSkipPastRoot(rgwzPaths, countof(rgwzPaths), FALSE, FALSE, TRUE);
982 {
983 for (DWORD i = 0; i < countof(rgwzPaths); ++i)
984 {
985 ValidateFullyQualifiedPath(rgwzPaths[i], FALSE, FALSE);
986 ValidateRootedPath(rgwzPaths[i], TRUE);
987
988 hr = StrAllocString(&sczPath, rgwzPaths[i], 0);
989 NativeAssert::Succeeded(hr, "Failed to copy string");
990
991 PathFixedReplaceForwardSlashes(sczPath);
992 ValidateFullyQualifiedPath(sczPath, FALSE, FALSE);
993 ValidateRootedPath(sczPath, TRUE);
994 }
995 }
996 finally
997 {
998 ReleaseStr(sczPath);
999 }
1000 } 993 }
1001 994
1002 [Fact] 995 [Fact]
1003 void PathIsNotRootedAndNotFullyQualifiedTest() 996 void PathIsNotRootedAndNotFullyQualifiedTest()
1004 { 997 {
1005 HRESULT hr = S_OK; 998 LPCWSTR rgwzPaths[18] =
1006 LPWSTR sczPath = NULL;
1007 LPCWSTR rgwzPaths[9] =
1008 { 999 {
1009 NULL, 1000 NULL, NULL,
1010 L"", 1001 L"", NULL,
1011 L"dir", 1002 L"dir", NULL,
1012 L"dir/subdir", 1003 L"dir/subdir", NULL,
1013 L"@:/foo", // 064 = @ 065 = A 1004 L"@:/foo", NULL, // 064 = @ 065 = A
1014 L"[://", // 091 = [ 090 = Z 1005 L"[://", NULL, // 091 = [ 090 = Z
1015 L"`:/foo ", // 096 = ` 097 = a 1006 L"`:/foo ", NULL, // 096 = ` 097 = a
1016 L"{://", // 123 = { 122 = z 1007 L"{://", NULL, // 123 = { 122 = z
1017 L"[:", 1008 L"[:", NULL,
1018 }; 1009 };
1019 1010
1011 ValidateSkipPastRoot(rgwzPaths, countof(rgwzPaths), FALSE, FALSE, FALSE);
1012 }
1013
1014 void ValidateSkipPastRoot(LPCWSTR* rgwzPaths, DWORD cPaths, BOOL fExpectedPrefix, BOOL fExpectedFullyQualified, BOOL fExpectedRooted)
1015 {
1016 HRESULT hr = S_OK;
1017 LPWSTR sczPath = NULL;
1018 LPWSTR sczSkipRootPath = NULL;
1019 LPCWSTR wzSkipRootPath = NULL;
1020 BOOL fHasPrefix = FALSE;
1021
1020 try 1022 try
1021 { 1023 {
1022 for (DWORD i = 0; i < countof(rgwzPaths); ++i) 1024 for (DWORD i = 0; i < cPaths; i += 2)
1023 { 1025 {
1024 ValidateFullyQualifiedPath(rgwzPaths[i], FALSE, FALSE); 1026 wzSkipRootPath = PathSkipPastRoot(rgwzPaths[i], &fHasPrefix, NULL, NULL);
1025 ValidateRootedPath(rgwzPaths[i], FALSE); 1027 NativeAssert::StringEqual(rgwzPaths[i + 1], wzSkipRootPath);
1028 ValidateExtendedPrefixPath(rgwzPaths[i], fExpectedPrefix, fHasPrefix);
1029 ValidateFullyQualifiedPath(rgwzPaths[i], fExpectedFullyQualified);
1030 ValidateRootedPath(rgwzPaths[i], fExpectedRooted);
1026 1031
1027 if (!rgwzPaths[i]) 1032 if (rgwzPaths[i])
1028 { 1033 {
1029 continue; 1034 hr = StrAllocString(&sczPath, rgwzPaths[i], 0);
1035 NativeAssert::Succeeded(hr, "Failed to copy string");
1036
1037 PathFixedReplaceForwardSlashes(sczPath);
1030 } 1038 }
1031 1039
1032 hr = StrAllocString(&sczPath, rgwzPaths[i], 0); 1040 if (rgwzPaths[i + 1])
1033 NativeAssert::Succeeded(hr, "Failed to copy string"); 1041 {
1042 hr = StrAllocString(&sczSkipRootPath, rgwzPaths[i + 1], 0);
1043 NativeAssert::Succeeded(hr, "Failed to copy string");
1034 1044
1035 PathFixedReplaceForwardSlashes(sczPath); 1045 PathFixedReplaceForwardSlashes(sczSkipRootPath);
1036 ValidateFullyQualifiedPath(sczPath, FALSE, FALSE); 1046 }
1037 ValidateRootedPath(sczPath, FALSE); 1047
1048 wzSkipRootPath = PathSkipPastRoot(sczPath, &fHasPrefix, NULL, NULL);
1049 NativeAssert::StringEqual(sczSkipRootPath, wzSkipRootPath);
1050 ValidateExtendedPrefixPath(sczPath, fExpectedPrefix, fHasPrefix);
1051 ValidateFullyQualifiedPath(sczPath, fExpectedFullyQualified);
1052 ValidateRootedPath(sczPath, fExpectedRooted);
1038 } 1053 }
1039 } 1054 }
1040 finally 1055 finally
1041 { 1056 {
1042 ReleaseStr(sczPath); 1057 ReleaseStr(sczPath);
1058 ReleaseStr(sczSkipRootPath);
1043 } 1059 }
1044 } 1060 }
1045 1061
1046 void ValidateFullyQualifiedPath(LPCWSTR wzPath, BOOL fExpected, BOOL fExpectedHasPrefix) 1062 void ValidateExtendedPrefixPath(LPCWSTR wzPath, BOOL fExpected, BOOL fHasExtendedPrefix)
1047 { 1063 {
1048 BOOL fHasLongPathPrefix = FALSE; 1064 String^ message = String::Format("HasExtendedPrefix: {0}", gcnew String(wzPath));
1049 BOOL fRooted = PathIsFullyQualified(wzPath, &fHasLongPathPrefix);
1050 String^ message = String::Format("IsFullyQualified: {0}", gcnew String(wzPath));
1051 if (fExpected) 1065 if (fExpected)
1052 { 1066 {
1053 Assert::True(fRooted, message); 1067 Assert::True(fHasExtendedPrefix, message);
1054 } 1068 }
1055 else 1069 else
1056 { 1070 {
1057 Assert::False(fRooted, message); 1071 Assert::False(fHasExtendedPrefix, message);
1058 } 1072 }
1073 }
1059 1074
1060 message = String::Format("HasLongPathPrefix: {0}", gcnew String(wzPath)); 1075 void ValidateFullyQualifiedPath(LPCWSTR wzPath, BOOL fExpected)
1061 if (fExpectedHasPrefix) 1076 {
1077 BOOL fRooted = PathIsFullyQualified(wzPath);
1078 String^ message = String::Format("IsFullyQualified: {0}", gcnew String(wzPath));
1079 if (fExpected)
1062 { 1080 {
1063 Assert::True(fHasLongPathPrefix, message); 1081 Assert::True(fRooted, message);
1064 } 1082 }
1065 else 1083 else
1066 { 1084 {
1067 Assert::False(fHasLongPathPrefix, message); 1085 Assert::False(fRooted, message);
1068 } 1086 }
1069 } 1087 }
1070 1088