2 // System.IO.Path Test Cases
5 // Marcin Szczepanski (marcins@zipworld.com.au)
6 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
7 // Ben Maurer (bmaurer@users.sf.net)
8 // Gilles Freart (gfr@skynet.be)
9 // Atsushi Enomoto (atsushi@ximian.com)
10 // Sebastien Pouliot <sebastien@ximian.com>
12 // (c) Marcin Szczepanski
13 // (c) 2002 Ximian, Inc. (http://www.ximian.com)
14 // (c) 2003 Ben Maurer
15 // (c) 2003 Gilles Freart
16 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
19 using NUnit.Framework;
24 namespace MonoTests.System.IO
39 static char DSC = Path.DirectorySeparatorChar;
46 path1 = "/foo/test.txt";
49 } else if ('\\' == DSC) {
51 path1 = "c:\\foo\\test.txt";
52 path2 = Environment.GetEnvironmentVariable ("SYSTEMROOT");
56 //FIXME: For Mac. figure this out when we need it
57 path1 = "foo:test.txt";
66 return OS == OsType.Windows;
73 return OS == OsType.Unix;
80 return OS == OsType.Mac;
85 public void ChangeExtension ()
87 string [] files = new string [3];
88 files [(int) OsType.Unix] = "/foo/test.doc";
89 files [(int) OsType.Windows] = "c:\\foo\\test.doc";
90 files [(int) OsType.Mac] = "foo:test.doc";
92 string testPath = Path.ChangeExtension (path1, "doc");
93 Assert.AreEqual (files [(int) OS], testPath, "ChangeExtension #01");
95 testPath = Path.ChangeExtension (String.Empty, ".extension");
96 Assert.AreEqual (String.Empty, testPath, "ChangeExtension #02");
98 testPath = Path.ChangeExtension (null, ".extension");
99 Assert.AreEqual (null, testPath, "ChangeExtension #03");
101 testPath = Path.ChangeExtension ("path", null);
102 Assert.AreEqual ("path", testPath, "ChangeExtension #04");
104 testPath = Path.ChangeExtension ("path.ext", "doc");
105 Assert.AreEqual ("path.doc", testPath, "ChangeExtension #05");
107 testPath = Path.ChangeExtension ("path.ext1.ext2", "doc");
108 Assert.AreEqual ("path.ext1.doc", testPath, "ChangeExtension #06");
110 testPath = Path.ChangeExtension ("hogehoge.xml", ".xsl");
111 Assert.AreEqual ("hogehoge.xsl", testPath, "ChangeExtension #07");
112 testPath = Path.ChangeExtension ("hogehoge", ".xsl");
113 Assert.AreEqual ("hogehoge.xsl", testPath, "ChangeExtension #08");
114 testPath = Path.ChangeExtension ("hogehoge.xml", "xsl");
115 Assert.AreEqual ("hogehoge.xsl", testPath, "ChangeExtension #09");
116 testPath = Path.ChangeExtension ("hogehoge", "xsl");
117 Assert.AreEqual ("hogehoge.xsl", testPath, "ChangeExtension #10");
118 testPath = Path.ChangeExtension ("hogehoge.xml", String.Empty);
119 Assert.AreEqual ("hogehoge.", testPath, "ChangeExtension #11");
120 testPath = Path.ChangeExtension ("hogehoge", String.Empty);
121 Assert.AreEqual ("hogehoge.", testPath, "ChangeExtension #12");
122 testPath = Path.ChangeExtension ("hogehoge.", null);
123 Assert.AreEqual ("hogehoge", testPath, "ChangeExtension #13");
124 testPath = Path.ChangeExtension ("hogehoge", null);
125 Assert.AreEqual ("hogehoge", testPath, "ChangeExtension #14");
126 testPath = Path.ChangeExtension (String.Empty, null);
127 Assert.AreEqual (String.Empty, testPath, "ChangeExtension #15");
128 testPath = Path.ChangeExtension (String.Empty, "bashrc");
129 Assert.AreEqual (String.Empty, testPath, "ChangeExtension #16");
130 testPath = Path.ChangeExtension (String.Empty, ".bashrc");
131 Assert.AreEqual (String.Empty, testPath, "ChangeExtension #17");
132 testPath = Path.ChangeExtension (null, null);
133 Assert.IsNull (testPath, "ChangeExtension #18");
137 public void ChangeExtension_Extension_InvalidPathChars ()
139 string fn = Path.ChangeExtension ("file.ext", "<");
140 Assert.AreEqual ("file.<", fn, "Invalid filename");
144 public void ChangeExtension_Path_InvalidPathChars ()
147 Path.ChangeExtension ("fi\0le.ext", ".extension");
149 } catch (ArgumentException ex) {
150 // Illegal characters in path
151 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
152 Assert.IsNull (ex.InnerException, "#3");
153 Assert.IsNotNull (ex.Message, "#4");
154 Assert.IsNull (ex.ParamName, "#5");
159 public void Combine ()
161 string [] files = new string [3];
162 files [(int) OsType.Unix] = "/etc/init.d";
163 files [(int) OsType.Windows] = Environment.GetEnvironmentVariable ("SYSTEMROOT") + @"\system32";
164 files [(int) OsType.Mac] = "foo:bar";
166 string testPath = Path.Combine (path2, path3);
167 Assert.AreEqual (files [(int) OS], testPath, "Combine #01");
169 testPath = Path.Combine ("one", String.Empty);
170 Assert.AreEqual ("one", testPath, "Combine #02");
172 testPath = Path.Combine (String.Empty, "one");
173 Assert.AreEqual ("one", testPath, "Combine #03");
175 string current = Directory.GetCurrentDirectory ();
176 testPath = Path.Combine (current, "one");
178 string expected = current + DSC + "one";
179 Assert.AreEqual (expected, testPath, "Combine #04");
181 testPath = Path.Combine ("one", current);
182 // LAMESPEC noted in Path.cs
183 Assert.AreEqual (current, testPath, "Combine #05");
185 testPath = Path.Combine (current, expected);
186 Assert.AreEqual (expected, testPath, "Combine #06");
188 testPath = DSC + "one";
189 testPath = Path.Combine (testPath, "two" + DSC);
190 expected = DSC + "one" + DSC + "two" + DSC;
191 Assert.AreEqual (expected, testPath, "Combine #06");
193 testPath = "one" + DSC;
194 testPath = Path.Combine (testPath, DSC + "two");
195 expected = DSC + "two";
196 Assert.AreEqual (expected, testPath, "Combine #06");
198 testPath = "one" + DSC;
199 testPath = Path.Combine (testPath, "two" + DSC);
200 expected = "one" + DSC + "two" + DSC;
201 Assert.AreEqual (expected, testPath, "Combine #07");
205 public void Combine_Path1_InvalidPathChars ()
208 Path.Combine ("a\0", "one");
210 } catch (ArgumentException ex) {
211 // Illegal characters in path
212 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
213 Assert.IsNull (ex.InnerException, "#3");
214 Assert.IsNotNull (ex.Message, "#4");
215 Assert.IsNull (ex.ParamName, "#5");
220 public void Combine_Path1_Null ()
223 Path.Combine (null, "one");
225 } catch (ArgumentNullException ex) {
226 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
227 Assert.IsNull (ex.InnerException, "#3");
228 Assert.IsNotNull (ex.Message, "#4");
229 Assert.AreEqual ("path1", ex.ParamName, "#5");
234 public void Combine_Path2_InvalidPathChars ()
237 Path.Combine ("one", "a\0");
239 } catch (ArgumentException ex) {
240 // Illegal characters in path
241 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
242 Assert.IsNull (ex.InnerException, "#3");
243 Assert.IsNotNull (ex.Message, "#4");
244 Assert.IsNull (ex.ParamName, "#5");
249 public void Combine_Path2_Null ()
252 Path.Combine ("one", null);
254 } catch (ArgumentNullException ex) {
255 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
256 Assert.IsNull (ex.InnerException, "#3");
257 Assert.IsNotNull (ex.Message, "#4");
258 Assert.AreEqual ("path2", ex.ParamName, "#5");
263 public void GetDirectoryName ()
265 string [] files = new string [3];
266 files [(int) OsType.Unix] = "/foo";
267 files [(int) OsType.Windows] = "c:\\foo";
268 files [(int) OsType.Mac] = "foo";
270 string testDirName = Path.GetDirectoryName (path1);
271 Assert.AreEqual (files [(int) OS], testDirName, "#A1");
272 testDirName = Path.GetDirectoryName (files [(int) OS] + DSC);
273 Assert.AreEqual (files [(int) OS], testDirName, "#A2");
276 Assert.AreEqual ("C:\\foo", Path.GetDirectoryName ("C:\\foo\\foo.txt"), "#B1");
277 Assert.AreEqual (null, Path.GetDirectoryName ("C:"), "#B2");
278 Assert.AreEqual (null, Path.GetDirectoryName (@"C:\"), "#B3");
279 Assert.AreEqual (@"C:\", Path.GetDirectoryName (@"C:\dir"), "#B4");
280 Assert.AreEqual (@"C:\dir", Path.GetDirectoryName (@"C:\dir\"), "#B5");
281 Assert.AreEqual (@"C:\dir", Path.GetDirectoryName (@"C:\dir\dir"), "#B6");
282 Assert.AreEqual (@"C:\dir\dir", Path.GetDirectoryName (@"C:\dir\dir\"), "#B7");
284 Assert.AreEqual ("\\foo\\bar", Path.GetDirectoryName ("/foo//bar/dingus"), "#C1");
285 Assert.AreEqual ("foo\\bar", Path.GetDirectoryName ("foo/bar/"), "#C2");
286 Assert.AreEqual ("foo\\bar", Path.GetDirectoryName ("foo/bar\\xxx"), "#C3");
287 Assert.AreEqual ("\\\\host\\dir\\dir2", Path.GetDirectoryName ("\\\\host\\dir\\\\dir2\\path"), "#C4");
290 Assert.AreEqual (null, Path.GetDirectoryName (@"\\"), "#D1");
291 Assert.AreEqual (null, Path.GetDirectoryName (@"\\server"), "#D2");
292 Assert.AreEqual (null, Path.GetDirectoryName (@"\\server\share"), "#D3");
293 Assert.AreEqual (@"\\server\share", Path.GetDirectoryName (@"\\server\share\"), "#D4");
294 Assert.AreEqual (@"\\server\share", Path.GetDirectoryName (@"\\server\share\dir"), "#D5");
295 Assert.AreEqual (@"\\server\share\dir", Path.GetDirectoryName (@"\\server\share\dir\subdir"), "#D6");
297 Assert.AreEqual ("/etc", Path.GetDirectoryName ("/etc/hostname"), "#B1");
298 Assert.AreEqual ("/foo/bar", Path.GetDirectoryName ("/foo//bar/dingus"), "#B2");
299 Assert.AreEqual ("foo/bar", Path.GetDirectoryName ("foo/bar/"), "#B3");
300 Assert.AreEqual ("/", Path.GetDirectoryName ("/tmp"), "#B4");
301 Assert.IsNull (Path.GetDirectoryName ("/"), "#B5");
302 Assert.AreEqual ("a", Path.GetDirectoryName ("a//b"), "#B6");
307 public void GetDirectoryName_Path_Empty ()
310 Path.GetDirectoryName (String.Empty);
312 } catch (ArgumentException ex) {
313 // The path is not of a legal form
314 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
315 Assert.IsNull (ex.InnerException, "#3");
316 Assert.IsNotNull (ex.Message, "#4");
317 Assert.IsNull (ex.ParamName, "#5");
322 public void GetDirectoryName_Path_InvalidPathChars ()
325 Path.GetDirectoryName ("hi\0world");
327 } catch (ArgumentException ex) {
328 // Illegal characters in path
329 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
330 Assert.IsNull (ex.InnerException, "#3");
331 Assert.IsNotNull (ex.Message, "#4");
332 Assert.IsNull (ex.ParamName, "#5");
337 public void GetDirectoryName_Path_Null ()
339 Assert.IsNull (Path.GetDirectoryName (null));
343 public void GetDirectoryName_Path_Whitespace ()
346 Path.GetDirectoryName (" ");
348 } catch (ArgumentException ex) {
349 // The path is not of a legal form
350 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
351 Assert.IsNull (ex.InnerException, "#3");
352 Assert.IsNotNull (ex.Message, "#4");
353 Assert.IsNull (ex.ParamName, "#5");
358 public void GetExtension ()
360 string testExtn = Path.GetExtension (path1);
362 Assert.AreEqual (".txt", testExtn, "GetExtension #01");
364 testExtn = Path.GetExtension (path2);
365 Assert.AreEqual (String.Empty, testExtn, "GetExtension #02");
367 testExtn = Path.GetExtension (String.Empty);
368 Assert.AreEqual (String.Empty, testExtn, "GetExtension #03");
370 testExtn = Path.GetExtension (null);
371 Assert.AreEqual (null, testExtn, "GetExtension #04");
373 testExtn = Path.GetExtension (" ");
374 Assert.AreEqual (String.Empty, testExtn, "GetExtension #05");
376 testExtn = Path.GetExtension (path1 + ".doc");
377 Assert.AreEqual (".doc", testExtn, "GetExtension #06");
379 testExtn = Path.GetExtension (path1 + ".doc" + DSC + "a.txt");
380 Assert.AreEqual (".txt", testExtn, "GetExtension #07");
382 testExtn = Path.GetExtension (".");
383 Assert.AreEqual (String.Empty, testExtn, "GetExtension #08");
385 testExtn = Path.GetExtension ("end.");
386 Assert.AreEqual (String.Empty, testExtn, "GetExtension #09");
388 testExtn = Path.GetExtension (".start");
389 Assert.AreEqual (".start", testExtn, "GetExtension #10");
391 testExtn = Path.GetExtension (".a");
392 Assert.AreEqual (".a", testExtn, "GetExtension #11");
394 testExtn = Path.GetExtension ("a.");
395 Assert.AreEqual (String.Empty, testExtn, "GetExtension #12");
397 testExtn = Path.GetExtension ("a");
398 Assert.AreEqual (String.Empty, testExtn, "GetExtension #13");
400 testExtn = Path.GetExtension ("makefile");
401 Assert.AreEqual (String.Empty, testExtn, "GetExtension #14");
405 public void GetExtension_Path_InvalidPathChars ()
408 Path.GetExtension ("hi\0world.txt");
410 } catch (ArgumentException ex) {
411 // Illegal characters in path.
412 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
413 Assert.IsNull (ex.InnerException, "#3");
414 Assert.IsNotNull (ex.Message, "#4");
415 Assert.IsNull (ex.ParamName, "#5");
420 public void GetFileName ()
422 string testFileName = Path.GetFileName (path1);
424 Assert.AreEqual ("test.txt", testFileName, "#1");
425 testFileName = Path.GetFileName (null);
426 Assert.AreEqual (null, testFileName, "#2");
427 testFileName = Path.GetFileName (String.Empty);
428 Assert.AreEqual (String.Empty, testFileName, "#3");
429 testFileName = Path.GetFileName (" ");
430 Assert.AreEqual (" ", testFileName, "#4");
434 public void GetFileName_Path_InvalidPathChars ()
437 Path.GetFileName ("hi\0world");
439 } catch (ArgumentException ex) {
440 // Illegal characters in path
441 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
442 Assert.IsNull (ex.InnerException, "#3");
443 Assert.IsNotNull (ex.Message, "#4");
444 Assert.IsNull (ex.ParamName, "#5");
449 public void GetFileNameWithoutExtension ()
451 string testFileName = Path.GetFileNameWithoutExtension (path1);
453 Assert.AreEqual ("test", testFileName, "GetFileNameWithoutExtension #01");
455 testFileName = Path.GetFileNameWithoutExtension (null);
456 Assert.AreEqual (null, testFileName, "GetFileNameWithoutExtension #02");
458 testFileName = Path.GetFileNameWithoutExtension (String.Empty);
459 Assert.AreEqual (String.Empty, testFileName, "GetFileNameWithoutExtension #03");
463 public void GetFileNameWithoutExtension_Path_InvalidPathChars ()
466 Path.GetFileNameWithoutExtension ("hi\0world");
468 } catch (ArgumentException ex) {
469 // Illegal characters in path
470 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
471 Assert.IsNull (ex.InnerException, "#3");
472 Assert.IsNotNull (ex.Message, "#4");
473 Assert.IsNull (ex.ParamName, "#5");
478 public void GetFullPath ()
480 string current = Directory.GetCurrentDirectory ();
482 string testFullPath = Path.GetFullPath ("foo.txt");
483 string expected = current + DSC + "foo.txt";
484 Assert.AreEqual (expected, testFullPath, "GetFullPath #01");
486 testFullPath = Path.GetFullPath ("a//./.././foo.txt");
487 Assert.AreEqual (expected, testFullPath, "GetFullPath #02");
491 public void GetFullPath_Unix ()
497 string [,] test = new string [,] {
498 {"root////././././././../root/././../root", "root"},
500 {"root/./", "root/"},
501 {"root/./", "root/"},
502 {"root/../", String.Empty},
503 {"root/../", String.Empty},
504 {"root/../..", String.Empty},
505 {"root/.hiddenfile", "root/.hiddenfile"},
506 {"root/. /", "root/. /"},
507 {"root/.. /", "root/.. /"},
508 {"root/..weirdname", "root/..weirdname"},
509 {"root/..", String.Empty},
510 {"root/../a/b/../../..", String.Empty},
511 {"root/./..", String.Empty},
512 {"..", String.Empty},
514 {"root//dir", "root/dir"},
515 {"root/. /", "root/. /"},
516 {"root/.. /", "root/.. /"},
517 {"root/ . /", "root/ . /"},
518 {"root/ .. /", "root/ .. /"},
519 {"root/./", "root/"},
520 //ERROR! Paths are trimmed
521 // I don't understand this comment^^.
522 // No trimming occurs but the paths are not equal. That's why the test fails. Commented out.
523 //{"root/.. /", "root/.. /"},
524 {".//", String.Empty}
527 for (int i = 0; i < test.GetUpperBound (0); i++) {
528 Assert.AreEqual (root + test [i, 1], Path.GetFullPath (root + test [i, 0]),
529 String.Format ("GetFullPathUnix #{0}", i));
532 Assert.AreEqual ("/", Path.GetFullPath ("/"), "#01");
533 Assert.AreEqual ("/hey", Path.GetFullPath ("/hey"), "#02");
534 Assert.AreEqual (Environment.CurrentDirectory, Path.GetFullPath ("."), "#03");
535 Assert.AreEqual (Path.Combine (Environment.CurrentDirectory, "hey"),
536 Path.GetFullPath ("hey"), "#04");
540 public void GetFullPath_Windows ()
545 string root = "C:\\";
546 string [,] test = new string [,] {
547 {"root////././././././../root/././../root", "root"},
549 {"root/./", "root\\"},
550 {"root/./", "root\\"},
554 {"root/.hiddenfile", "root\\.hiddenfile"},
555 {"root/. /", "root\\"},
557 {"root/..weirdname", "root\\..weirdname"},
559 {"root/../a/b/../../..", ""},
563 {"root//dir", "root\\dir"},
564 {"root/. /", "root\\"},
567 {"root/ . /", "root\\"},
570 {"root/./", "root\\"},
575 for (int i = 0; i < test.GetUpperBound (0); i++) {
577 Assert.AreEqual (root + test [i, 1], Path.GetFullPath (root + test [i, 0]),
578 String.Format ("GetFullPathWindows #{0}", i));
579 } catch (Exception ex) {
580 Assert.Fail (String.Format ("GetFullPathWindows #{0} (\"{1}\") failed: {2}",
581 i, root + test [i, 0], ex.GetType ()));
586 string root2 = @"\\server\share";
587 root = @"\\server\share\";
588 test = new string [,] {
589 {"root////././././././../root/././../root", "root"},
591 {"root/./", "root\\"},
592 {"root/./", "root\\"},
595 {"root/../..", null},
596 {"root/.hiddenfile", "root\\.hiddenfile"},
597 {"root/. /", "root\\"},
599 {"root/..weirdname", "root\\..weirdname"},
601 {"root/../a/b/../../..", null},
605 {"root//dir", "root\\dir"},
606 {"root/. /", "root\\"},
609 {"root/ . /", "root\\"},
612 {"root/./", "root\\"},
617 for (int i = 0; i < test.GetUpperBound (0); i++) {
618 // "null" means we have to compare against "root2"
619 string res = test [i, 1] != null
623 Assert.AreEqual (res, Path.GetFullPath (root + test [i, 0]),
624 String.Format ("GetFullPathWindows UNC #{0}", i));
625 } catch (AssertionException) {
627 } catch (Exception ex) {
628 Assert.Fail (String.Format ("GetFullPathWindows UNC #{0} (\"{1}\") failed: {2}",
629 i, root + test [i, 0], ex.GetType ()));
633 test = new string [,] {
634 {"root////././././././../root/././../root", "root"},
636 {"root/./", "root\\"},
637 {"root/./", "root\\"},
640 {"root/../..", null},
641 {"root/.hiddenfile", "root\\.hiddenfile"},
642 {"root/. /", "root\\"},
644 {"root/..weirdname", "root\\..weirdname"},
646 {"root/../a/b/../../..", null},
650 {"root//dir", "root\\dir"},
651 {"root/. /", "root\\"},
654 {"root/ . /", "root\\"},
657 {"root/./", "root\\"},
662 string root3 = @"//server/share";
663 root = @"//server/share/";
664 bool needSlashConvert = Path.DirectorySeparatorChar != '/';
666 for (int i = 0; i < test.GetUpperBound (0); i++) {
667 // "null" means we have to compare against "root2"
668 string res = test [i, 1] != null
671 if (needSlashConvert)
672 res = res.Replace ('/', Path.DirectorySeparatorChar);
674 Assert.AreEqual (res, Path.GetFullPath (root + test [i, 0]),
675 String.Format ("GetFullPathWindows UNC[2] #{0}", i));
676 } catch (AssertionException) {
678 } catch (Exception ex) {
679 Assert.Fail (String.Format ("GetFullPathWindows UNC[2] #{0} (\"{1}\") failed: {2}",
680 i, root + test [i, 0], ex.GetType ()));
686 public void GetFullPath_Path_Empty ()
689 Path.GetFullPath (String.Empty);
691 } catch (ArgumentException ex) {
692 // The path is not of a legal form
693 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
694 Assert.IsNull (ex.InnerException, "#3");
695 Assert.IsNotNull (ex.Message, "#4");
696 Assert.IsNull (ex.ParamName, "#5");
701 public void GetFullPath_Path_EndingSeparator ()
703 string fp = Path.GetFullPath ("something/");
704 char end = fp [fp.Length - 1];
705 Assert.IsTrue (end == Path.DirectorySeparatorChar);
709 public void GetFullPath_Path_InvalidPathChars ()
712 Path.GetFullPath ("hi\0world");
714 } catch (ArgumentException ex) {
715 // Illegal characters in path
716 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
717 Assert.IsNull (ex.InnerException, "#3");
718 Assert.IsNotNull (ex.Message, "#4");
719 Assert.IsNull (ex.ParamName, "#5");
724 public void GetFullPath_Path_Null ()
727 Path.GetFullPath (null);
729 } catch (ArgumentNullException ex) {
730 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
731 Assert.IsNull (ex.InnerException, "#3");
732 Assert.IsNotNull (ex.Message, "#4");
733 Assert.AreEqual ("path", ex.ParamName, "#5");
738 public void GetFullPath_Path_Whitespace ()
741 Path.GetFullPath (" ");
743 } catch (ArgumentException ex) {
744 // The path is not of a legal form
745 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
746 Assert.IsNull (ex.InnerException, "#3");
747 Assert.IsNotNull (ex.Message, "#4");
748 Assert.IsNull (ex.ParamName, "#5");
753 public void GetFullPath2 ()
756 Assert.AreEqual (@"Z:\", Path.GetFullPath ("Z:"), "GetFullPath w#01");
757 #if !TARGET_JVM // Java full (canonical) path always starts with caps drive letter
758 Assert.AreEqual (@"c:\abc\def", Path.GetFullPath (@"c:\abc\def"), "GetFullPath w#02");
760 Assert.IsTrue (Path.GetFullPath (@"\").EndsWith (@"\"), "GetFullPath w#03");
761 // "\\\\" is not allowed
762 Assert.IsTrue (Path.GetFullPath ("/").EndsWith (@"\"), "GetFullPath w#05");
763 // "//" is not allowed
764 Assert.IsTrue (Path.GetFullPath ("readme.txt").EndsWith (@"\readme.txt"), "GetFullPath w#07");
765 Assert.IsTrue (Path.GetFullPath ("c").EndsWith (@"\c"), "GetFullPath w#08");
766 Assert.IsTrue (Path.GetFullPath (@"abc\def").EndsWith (@"abc\def"), "GetFullPath w#09");
767 Assert.IsTrue (Path.GetFullPath (@"\abc\def").EndsWith (@"\abc\def"), "GetFullPath w#10");
768 Assert.AreEqual (@"\\abc\def", Path.GetFullPath (@"\\abc\def"), "GetFullPath w#11");
769 Assert.AreEqual (Directory.GetCurrentDirectory () + @"\abc\def", Path.GetFullPath (@"abc//def"), "GetFullPath w#12");
770 Assert.AreEqual (Directory.GetCurrentDirectory ().Substring (0, 2) + @"\abc\def", Path.GetFullPath ("/abc/def"), "GetFullPath w#13");
771 Assert.AreEqual (@"\\abc\def", Path.GetFullPath ("//abc/def"), "GetFullPath w#14");
773 Assert.AreEqual ("/", Path.GetFullPath ("/"), "#01");
774 Assert.AreEqual ("/hey", Path.GetFullPath ("/hey"), "#02");
775 Assert.AreEqual (Environment.CurrentDirectory, Path.GetFullPath ("."), "#03");
776 Assert.AreEqual (Path.Combine (Environment.CurrentDirectory, "hey"),
777 Path.GetFullPath ("hey"), "#04");
782 public void GetPathRoot ()
787 current = Directory.GetCurrentDirectory ();
788 expected = current [0].ToString ();
790 current = @"J:\Some\Strange Directory\Name";
794 string pathRoot = Path.GetPathRoot (current);
795 Assert.AreEqual (expected, pathRoot, "GetPathRoot #01");
799 public void GetPathRoot2 ()
801 // note: this method doesn't call Directory.GetCurrentDirectory so it can be
802 // reused for partial trust unit tests in PathCas.cs
806 pathRoot = Path.GetPathRoot ("hola");
807 Assert.AreEqual (String.Empty, pathRoot, "#A1");
808 pathRoot = Path.GetPathRoot (null);
809 Assert.AreEqual (null, pathRoot, "#A2");
812 Assert.AreEqual ("z:", Path.GetPathRoot ("z:"), "GetPathRoot w#01");
813 Assert.AreEqual ("c:\\", Path.GetPathRoot ("c:\\abc\\def"), "GetPathRoot w#02");
814 Assert.AreEqual ("\\", Path.GetPathRoot ("\\"), "GetPathRoot w#03");
815 Assert.AreEqual ("\\\\", Path.GetPathRoot ("\\\\"), "GetPathRoot w#04");
816 Assert.AreEqual ("\\", Path.GetPathRoot ("/"), "GetPathRoot w#05");
817 Assert.AreEqual ("\\\\", Path.GetPathRoot ("//"), "GetPathRoot w#06");
818 Assert.AreEqual (String.Empty, Path.GetPathRoot ("readme.txt"), "GetPathRoot w#07");
819 Assert.AreEqual (String.Empty, Path.GetPathRoot ("c"), "GetPathRoot w#08");
820 Assert.AreEqual (String.Empty, Path.GetPathRoot ("abc\\def"), "GetPathRoot w#09");
821 Assert.AreEqual ("\\", Path.GetPathRoot ("\\abc\\def"), "GetPathRoot w#10");
822 Assert.AreEqual ("\\\\abc\\def", Path.GetPathRoot ("\\\\abc\\def"), "GetPathRoot w#11");
823 Assert.AreEqual (String.Empty, Path.GetPathRoot ("abc//def"), "GetPathRoot w#12");
824 Assert.AreEqual ("\\", Path.GetPathRoot ("/abc/def"), "GetPathRoot w#13");
825 Assert.AreEqual ("\\\\abc\\def", Path.GetPathRoot ("//abc/def"), "GetPathRoot w#14");
826 Assert.AreEqual (@"C:\", Path.GetPathRoot (@"C:\"), "GetPathRoot w#15");
827 Assert.AreEqual (@"C:\", Path.GetPathRoot (@"C:\\"), "GetPathRoot w#16");
828 Assert.AreEqual ("\\\\abc\\def", Path.GetPathRoot ("\\\\abc\\def\\ghi"), "GetPathRoot w#17");
830 // TODO: Same tests for Unix.
835 public void GetPathRoot_Path_Empty ()
838 Path.GetPathRoot (String.Empty);
840 } catch (ArgumentException ex) {
841 // The path is not of a legal form
842 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
843 Assert.IsNull (ex.InnerException, "#3");
844 Assert.IsNotNull (ex.Message, "#4");
845 Assert.IsNull (ex.ParamName, "#5");
851 [Category ("NotWorking")] // we also throw ArgumentException on 1.0 profile
853 public void GetPathRoot_Path_InvalidPathChars ()
857 Path.GetPathRoot ("hi\0world");
859 } catch (ArgumentException ex) {
860 // Illegal characters in path
861 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
862 Assert.IsNull (ex.InnerException, "#3");
863 Assert.IsNotNull (ex.Message, "#4");
864 Assert.IsNull (ex.ParamName, "#5");
867 Assert.AreEqual (String.Empty, Path.GetPathRoot ("hi\0world"));
872 public void GetPathRoot_Path_Whitespace ()
875 Path.GetPathRoot (" ");
877 } catch (ArgumentException ex) {
878 // The path is not of a legal form
879 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
880 Assert.IsNull (ex.InnerException, "#3");
881 Assert.IsNotNull (ex.Message, "#4");
882 Assert.IsNull (ex.ParamName, "#5");
887 public void GetTempPath ()
889 string getTempPath = Path.GetTempPath ();
890 Assert.IsTrue (getTempPath != String.Empty, "GetTempPath #01");
891 Assert.IsTrue (Path.IsPathRooted (getTempPath), "GetTempPath #02");
892 Assert.AreEqual (Path.DirectorySeparatorChar, getTempPath [getTempPath.Length - 1], "GetTempPath #03");
896 public void GetTempFileName ()
898 string getTempFileName = null;
900 getTempFileName = Path.GetTempFileName ();
901 Assert.IsTrue (getTempFileName != String.Empty, "GetTempFileName #01");
902 Assert.IsTrue (File.Exists (getTempFileName), "GetTempFileName #02");
904 if (getTempFileName != null && getTempFileName != String.Empty){
905 File.Delete (getTempFileName);
911 public void HasExtension ()
913 Assert.AreEqual (true, Path.HasExtension ("foo.txt"), "HasExtension #01");
914 Assert.AreEqual (false, Path.HasExtension ("foo"), "HasExtension #02");
915 Assert.AreEqual (true, Path.HasExtension (path1), "HasExtension #03");
916 Assert.AreEqual (false, Path.HasExtension (path2), "HasExtension #04");
917 Assert.AreEqual (false, Path.HasExtension (null), "HasExtension #05");
918 Assert.AreEqual (false, Path.HasExtension (String.Empty), "HasExtension #06");
919 Assert.AreEqual (false, Path.HasExtension (" "), "HasExtension #07");
920 Assert.AreEqual (false, Path.HasExtension ("."), "HasExtension #08");
921 Assert.AreEqual (false, Path.HasExtension ("end."), "HasExtension #09");
922 Assert.AreEqual (true, Path.HasExtension (".start"), "HasExtension #10");
923 Assert.AreEqual (true, Path.HasExtension (".a"), "HasExtension #11");
924 Assert.AreEqual (false, Path.HasExtension ("a."), "HasExtension #12");
925 Assert.AreEqual (false, Path.HasExtension ("Makefile"), "HasExtension #13");
929 public void HasExtension_Path_InvalidPathChars ()
932 Path.HasExtension ("hi\0world.txt");
934 } catch (ArgumentException ex) {
935 // Illegal characters in path
936 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
937 Assert.IsNull (ex.InnerException, "#3");
938 Assert.IsNotNull (ex.Message, "#4");
939 Assert.IsNull (ex.ParamName, "#5");
944 public void IsPathRooted ()
946 Assert.IsTrue (Path.IsPathRooted (path2), "IsPathRooted #01");
947 Assert.IsTrue (!Path.IsPathRooted (path3), "IsPathRooted #02");
948 Assert.IsTrue (!Path.IsPathRooted (null), "IsPathRooted #03");
949 Assert.IsTrue (!Path.IsPathRooted (String.Empty), "IsPathRooted #04");
950 Assert.IsTrue (!Path.IsPathRooted (" "), "IsPathRooted #05");
951 Assert.IsTrue (Path.IsPathRooted ("/"), "IsPathRooted #06");
952 Assert.IsTrue (Path.IsPathRooted ("//"), "IsPathRooted #07");
953 Assert.IsTrue (!Path.IsPathRooted (":"), "IsPathRooted #08");
956 Assert.IsTrue (Path.IsPathRooted ("\\"), "IsPathRooted #09");
957 Assert.IsTrue (Path.IsPathRooted ("\\\\"), "IsPathRooted #10");
958 Assert.IsTrue (Path.IsPathRooted ("z:"), "IsPathRooted #11");
959 Assert.IsTrue (Path.IsPathRooted ("z:\\"), "IsPathRooted #12");
960 Assert.IsTrue (Path.IsPathRooted ("z:\\topdir"), "IsPathRooted #13");
961 // This looks MS BUG. It is treated as absolute path
962 Assert.IsTrue (Path.IsPathRooted ("z:curdir"), "IsPathRooted #14");
963 Assert.IsTrue (Path.IsPathRooted ("\\abc\\def"), "IsPathRooted #15");
965 Assert.IsTrue (!Path.IsPathRooted ("\\"), "IsPathRooted #09");
966 Assert.IsTrue (!Path.IsPathRooted ("\\\\"), "IsPathRooted #10");
967 Assert.IsTrue (!Path.IsPathRooted ("z:"), "IsPathRooted #11");
972 public void IsPathRooted_Path_Empty ()
974 Assert.IsTrue (!Path.IsPathRooted (String.Empty));
978 public void IsPathRooted_Path_InvalidPathChars ()
981 Path.IsPathRooted ("hi\0world");
983 } catch (ArgumentException ex) {
984 // Illegal characters in path.
985 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
986 Assert.IsNull (ex.InnerException, "#3");
987 Assert.IsNotNull (ex.Message, "#4");
988 Assert.IsNull (ex.ParamName, "#5");
993 public void IsPathRooted_Path_Null ()
995 Assert.IsTrue (!Path.IsPathRooted (null));
999 public void IsPathRooted_Path_Whitespace ()
1001 Assert.IsTrue (!Path.IsPathRooted (" "));
1005 public void CanonicalizeDots ()
1007 string current = Path.GetFullPath (".");
1008 Assert.IsTrue (!current.EndsWith ("."), "TestCanonicalizeDotst #01");
1009 string parent = Path.GetFullPath ("..");
1010 Assert.IsTrue (!current.EndsWith (".."), "TestCanonicalizeDotst #02");
1014 public void WindowsSystem32_76191 ()
1016 // check for Unix platforms - see FAQ for more details
1017 // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
1018 int platform = (int) Environment.OSVersion.Platform;
1019 if ((platform == 4) || (platform == 128) || (platform == 6))
1022 string curdir = Directory.GetCurrentDirectory ();
1025 string system = "C:\\WINDOWS\\system32\\";
1027 string system = Environment.SystemDirectory;
1029 Directory.SetCurrentDirectory (system);
1030 string drive = system.Substring (0, 2);
1031 Assert.AreEqual (system, Path.GetFullPath (drive), "current dir");
1034 Directory.SetCurrentDirectory (curdir);
1039 public void WindowsSystem32_77007 ()
1041 // check for Unix platforms - see FAQ for more details
1042 // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
1043 int platform = (int) Environment.OSVersion.Platform;
1044 if ((platform == 4) || (platform == 128) || (platform == 6))
1047 string curdir = Directory.GetCurrentDirectory ();
1050 string system = "C:\\WINDOWS\\system32\\";
1052 string system = Environment.SystemDirectory;
1054 Directory.SetCurrentDirectory (system);
1055 // e.g. C:dir (no backslash) will return CurrentDirectory + dir
1056 string dir = system.Substring (0, 2) + "dir";
1057 Assert.AreEqual (Path.Combine (system, "dir"), Path.GetFullPath (dir), "current dir");
1060 Directory.SetCurrentDirectory (curdir);
1066 [Ignore("Java full (canonical) path always returns windows dir in caps")]
1068 public void WindowsDriveC14N_77058 ()
1070 // check for Unix platforms - see FAQ for more details
1071 // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
1072 int platform = (int) Environment.OSVersion.Platform;
1073 if ((platform == 4) || (platform == 128) || (platform == 6))
1076 Assert.AreEqual (@"C:\Windows\dir", Path.GetFullPath (@"C:\Windows\System32\..\dir"), "1");
1077 Assert.AreEqual (@"C:\dir", Path.GetFullPath (@"C:\Windows\System32\..\..\dir"), "2");
1078 Assert.AreEqual (@"C:\dir", Path.GetFullPath (@"C:\Windows\System32\..\..\..\dir"), "3");
1079 Assert.AreEqual (@"C:\dir", Path.GetFullPath (@"C:\Windows\System32\..\..\..\..\dir"), "4");
1080 Assert.AreEqual (@"C:\dir\", Path.GetFullPath (@"C:\Windows\System32\..\.\..\.\..\dir\"), "5");
1084 public void InvalidPathChars_Values ()
1086 char[] invalid = Path.InvalidPathChars;
1089 Assert.AreEqual (36, invalid.Length, "Length");
1091 Assert.AreEqual (15, invalid.Length, "Length");
1093 foreach (char c in invalid) {
1099 if ((i == 0) || (i == 8) || ((i > 15) && (i < 19)) || ((i > 19) && (i < 26)))
1102 // in both 1.1 SP1 and 2.0
1103 if ((i == 34) || (i == 60) || (i == 62) || (i == 124))
1105 Assert.Fail (String.Format ("'{0}' (#{1}) is invalid", c, i));
1108 foreach (char c in invalid) {
1112 Assert.Fail (String.Format ("'{0}' (#{1}) is invalid", c, i));
1118 public void InvalidPathChars_Modify ()
1120 char[] expected = Path.InvalidPathChars;
1121 char[] invalid = Path.InvalidPathChars;
1122 char original = invalid[0];
1126 Assert.IsTrue (expected[0] == 'a', "expected");
1127 Assert.AreEqual (expected[0], Path.InvalidPathChars[0], "readonly");
1129 invalid[0] = original;
1135 public void GetInvalidFileNameChars_Values ()
1137 char[] invalid = Path.GetInvalidFileNameChars ();
1139 Assert.AreEqual (41, invalid.Length);
1140 foreach (char c in invalid) {
1144 if ((i == 34) || (i == 60) || (i == 62) || (i == 124))
1146 // ':', '*', '?', '\', '/'
1147 if ((i == 58) || (i == 42) || (i == 63) || (i == 92) || (i == 47))
1149 Assert.Fail (String.Format ("'{0}' (#{1}) is invalid", c, i));
1152 foreach (char c in invalid) {
1155 if ((i == 0) || (i == 47))
1157 Assert.Fail (String.Format ("'{0}' (#{1}) is invalid", c, i));
1163 public void GetInvalidFileNameChars_Modify ()
1165 char[] expected = Path.GetInvalidFileNameChars ();
1166 char[] invalid = Path.GetInvalidFileNameChars ();
1168 Assert.IsTrue (expected[0] != 'a', "expected");
1169 Assert.AreEqual (expected[0], Path.GetInvalidFileNameChars ()[0], "readonly");
1173 public void GetInvalidPathChars_Values ()
1175 char[] invalid = Path.GetInvalidPathChars ();
1177 Assert.AreEqual (36, invalid.Length);
1178 foreach (char c in invalid) {
1182 if ((i == 34) || (i == 60) || (i == 62) || (i == 124))
1184 Assert.Fail (String.Format ("'{0}' (#{1}) is invalid", c, i));
1187 foreach (char c in invalid) {
1191 Assert.Fail (String.Format ("'{0}' (#{1}) is invalid", c, i));
1197 public void GetInvalidPathChars_Order ()
1200 char [] invalid = Path.GetInvalidPathChars ();
1201 char [] expected = new char [36] { '\x22', '\x3C', '\x3E', '\x7C', '\x00', '\x01', '\x02',
1202 '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D',
1203 '\x0E', '\x0F', '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18',
1204 '\x19', '\x1A', '\x1B', '\x1C', '\x1D', '\x1E', '\x1F' };
1205 Assert.AreEqual (expected.Length, invalid.Length);
1206 for (int i = 0; i < expected.Length; i++ ) {
1207 Assert.AreEqual (expected [i], invalid [i], "Character at position " + i);
1213 public void GetInvalidPathChars_Modify ()
1215 char[] expected = Path.GetInvalidPathChars ();
1216 char[] invalid = Path.GetInvalidPathChars ();
1218 Assert.IsTrue (expected[0] != 'a', "expected");
1219 Assert.AreEqual (expected[0], Path.GetInvalidPathChars ()[0], "readonly");
1223 public void GetRandomFileName ()
1225 string s = Path.GetRandomFileName ();
1226 Assert.AreEqual (12, s.Length, "Length");
1227 char[] invalid = Path.GetInvalidFileNameChars ();
1228 for (int i=0; i < s.Length; i++) {
1230 Assert.AreEqual ('.', s[i], "8");
1232 Assert.IsTrue (Array.IndexOf (invalid, s[i]) == -1, i.ToString ());
1237 public void GetRandomFileNameIsAlphaNumerical ()
1239 string [] names = new string [1000];
1240 for (int i = 0; i < names.Length; i++)
1241 names [i] = Path.GetRandomFileName ();
1243 foreach (string name in names) {
1244 Assert.AreEqual (12, name.Length);
1245 Assert.AreEqual ('.', name [8]);
1247 for (int i = 0; i < 12; i++) {
1252 Assert.IsTrue (('a' <= c && c <= 'z') || ('0' <= c && c <= '9'));
1258 string Concat (string sep, params string [] parms)
1260 return String.Join (sep, parms);
1264 public void Combine_3Params ()
1266 string sep = Path.DirectorySeparatorChar.ToString ();
1269 Path.Combine (null, "two", "three");
1270 Assert.Fail ("#A1-1");
1276 Path.Combine ("one", null, "three");
1277 Assert.Fail ("#A1-2");
1283 Path.Combine ("one", "two", null);
1284 Assert.Fail ("#A1-3");
1289 Assert.AreEqual (Concat (sep, "one", "two", "three"), Path.Combine ("one", "two", "three"), "#A2-1");
1290 Assert.AreEqual (Concat (sep, sep + "one", "two", "three"), Path.Combine (sep + "one", "two", "three"), "#A2-2");
1291 Assert.AreEqual (Concat (sep, sep + "one", "two", "three"), Path.Combine (sep + "one" + sep, "two", "three"), "#A2-3");
1292 Assert.AreEqual (Concat (sep, sep + "two", "three"), Path.Combine (sep + "one" + sep, sep + "two", "three"), "#A2-4");
1293 Assert.AreEqual (Concat (sep, sep + "three"), Path.Combine (sep + "one" + sep, sep + "two", sep + "three"), "#A2-5");
1295 Assert.AreEqual (Concat (sep, sep + "one" + sep, "two", "three"), Path.Combine (sep + "one" + sep + sep, "two", "three"), "#A3");
1297 Assert.AreEqual ("", Path.Combine ("", "", ""), "#A4");
1301 public void Combine_4Params ()
1303 string sep = Path.DirectorySeparatorChar.ToString ();
1306 Path.Combine (null, "two", "three", "four");
1307 Assert.Fail ("#A1-1");
1313 Path.Combine ("one", null, "three", "four");
1314 Assert.Fail ("#A1-2");
1320 Path.Combine ("one", "two", null, "four");
1321 Assert.Fail ("#A1-3");
1327 Path.Combine ("one", "two", "three", null);
1328 Assert.Fail ("#A1-4");
1333 Assert.AreEqual (Concat (sep, "one", "two", "three", "four"), Path.Combine ("one", "two", "three", "four"), "#A2-1");
1334 Assert.AreEqual (Concat (sep, sep + "one", "two", "three", "four"), Path.Combine (sep + "one", "two", "three", "four"), "#A2-2");
1335 Assert.AreEqual (Concat (sep, sep + "one", "two", "three", "four"), Path.Combine (sep + "one" + sep, "two", "three", "four"), "#A2-3");
1336 Assert.AreEqual (Concat (sep, sep + "two", "three", "four"), Path.Combine (sep + "one" + sep, sep + "two", "three", "four"), "#A2-4");
1337 Assert.AreEqual (Concat (sep, sep + "three", "four"), Path.Combine (sep + "one" + sep, sep + "two", sep + "three", "four"), "#A2-5");
1338 Assert.AreEqual (Concat (sep, sep + "four"), Path.Combine (sep + "one" + sep, sep + "two", sep + "three", sep + "four"), "#A2-6");
1340 Assert.AreEqual (Concat (sep, sep + "one" + sep, "two", "three", "four"), Path.Combine (sep + "one" + sep + sep, "two", "three", "four"), "#A3");
1342 Assert.AreEqual ("", Path.Combine ("", "", "", ""), "#A4");
1346 public void Combine_ManyParams ()
1348 string sep = Path.DirectorySeparatorChar.ToString ();
1351 Path.Combine (null, "two", "three", "four", "five");
1352 Assert.Fail ("#A1-1");
1358 Path.Combine ("one", null, "three", "four", "five");
1359 Assert.Fail ("#A1-2");
1365 Path.Combine ("one", "two", null, "four", "five");
1366 Assert.Fail ("#A1-3");
1372 Path.Combine ("one", "two", "three", null, "five");
1373 Assert.Fail ("#A1-4");
1379 Path.Combine ("one", "two", "three", "four", null);
1380 Assert.Fail ("#A1-5");
1385 Assert.AreEqual (Concat (sep, "one", "two", "three", "four", "five"), Path.Combine ("one", "two", "three", "four", "five"), "#A2-1");
1386 Assert.AreEqual (Concat (sep, sep + "one", "two", "three", "four", "five"), Path.Combine (sep + "one", "two", "three", "four", "five"), "#A2-2");
1387 Assert.AreEqual (Concat (sep, sep + "one", "two", "three", "four", "five"), Path.Combine (sep + "one" + sep, "two", "three", "four", "five"), "#A2-3");
1388 Assert.AreEqual (Concat (sep, sep + "two", "three", "four", "five"), Path.Combine (sep + "one" + sep, sep + "two", "three", "four", "five"), "#A2-4");
1389 Assert.AreEqual (Concat (sep, sep + "three", "four", "five"), Path.Combine (sep + "one" + sep, sep + "two", sep + "three", "four", "five"), "#A2-5");
1390 Assert.AreEqual (Concat (sep, sep + "four", "five"), Path.Combine (sep + "one" + sep, sep + "two", sep + "three", sep + "four", "five"), "#A2-6");
1391 Assert.AreEqual (Concat (sep, sep + "five"), Path.Combine (sep + "one" + sep, sep + "two", sep + "three", sep + "four", sep + "five"), "#A2-6");
1393 Assert.AreEqual (Concat (sep, sep + "one" + sep, "two", "three", "four", "five"), Path.Combine (sep + "one" + sep + sep, "two", "three", "four", "five"), "#A3");
1395 Assert.AreEqual ("", Path.Combine ("", "", "", "", ""), "#A4");