@@ -29,15 +29,10 @@ public class TestWriteEnwikiLineDocTask : LuceneTestCase
2929 [ LuceneNetSpecific ] // Issue #832
3030 public virtual void TestCategoriesLineFileWithStringPath ( )
3131 {
32- // Test with absolute path
33- string fileName = "/path/to/file/document.txt" ;
34- string result = WriteEnwikiLineDocTask . CategoriesLineFile ( fileName ) ;
35- assertEquals ( "/path/to/file/categories-document.txt" , result ) ;
36-
3732 // Test with relative path
38- fileName = "data/document.txt" ;
39- result = WriteEnwikiLineDocTask . CategoriesLineFile ( fileName ) ;
40- assertEquals ( "data/ categories-document.txt" , result ) ;
33+ string fileName = "data/document.txt" ;
34+ string result = WriteEnwikiLineDocTask . CategoriesLineFile ( fileName ) ;
35+ assertEquals ( Path . Combine ( "data" , " categories-document.txt") , result ) ;
4136
4237 // Test with no directory
4338 fileName = "document.txt" ;
@@ -47,15 +42,22 @@ public virtual void TestCategoriesLineFileWithStringPath()
4742 // Test with complex path
4843 fileName = "../parent/subdir/document.txt" ;
4944 result = WriteEnwikiLineDocTask . CategoriesLineFile ( fileName ) ;
50- assertEquals ( "../parent/subdir/ categories-document.txt" , result ) ;
45+ assertEquals ( Path . Combine ( "../parent/subdir" , " categories-document.txt") , result ) ;
5146
52- // Test with Windows-style path
47+ // Test with Windows-style absolute path
5348 if ( Path . DirectorySeparatorChar == '\\ ' )
5449 {
5550 fileName = @"C:\Users\test\document.txt" ;
5651 result = WriteEnwikiLineDocTask . CategoriesLineFile ( fileName ) ;
5752 assertEquals ( @"C:\Users\test\categories-document.txt" , result ) ;
5853 }
54+ // Test with Unix-style absolute path
55+ else
56+ {
57+ fileName = "/home/test/document.txt" ;
58+ result = WriteEnwikiLineDocTask . CategoriesLineFile ( fileName ) ;
59+ assertEquals ( "/home/test/categories-document.txt" , result ) ;
60+ }
5961 }
6062
6163 [ Test ]
@@ -73,17 +75,17 @@ public virtual void TestCategoriesLineFileWithRelativePath()
7375 // Test with relative path from current directory
7476 string fileName = "subdir/document.txt" ;
7577 string result = WriteEnwikiLineDocTask . CategoriesLineFile ( fileName ) ;
76- assertEquals ( "subdir/ categories-document.txt" , result ) ;
78+ assertEquals ( Path . Combine ( "subdir" , " categories-document.txt") , result ) ;
7779
7880 // Test with "./" prefix
7981 fileName = "./document.txt" ;
8082 result = WriteEnwikiLineDocTask . CategoriesLineFile ( fileName ) ;
81- assertEquals ( "./ categories-document.txt", result ) ;
83+ assertEquals ( Path . Combine ( "." , " categories-document.txt") , result ) ;
8284
8385 // Test with parent directory reference
8486 fileName = "../document.txt" ;
8587 result = WriteEnwikiLineDocTask . CategoriesLineFile ( fileName ) ;
86- assertEquals ( "../ categories-document.txt" , result ) ;
88+ assertEquals ( Path . Combine ( ".." , " categories-document.txt") , result ) ;
8789 } ) ;
8890 }
8991 finally
@@ -104,7 +106,7 @@ public virtual void TestCategoriesLineFileComparisonWithFileInfo()
104106 string [ ] testPaths = {
105107 "document.txt" ,
106108 "data/document.txt" ,
107- "/absolute /path/document.txt"
109+ "relative /path/document.txt"
108110 } ;
109111
110112 foreach ( string path in testPaths )
0 commit comments