mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-22 23:15:20 +00:00
xplat tests for path characters
This commit is contained in:
@@ -619,20 +619,31 @@ public class UtilityTests
|
||||
|
||||
#region ReplaceInvalidFileNameChars Tests
|
||||
|
||||
#if WINDOWS
|
||||
[Theory]
|
||||
[InlineData("valid_filename.txt", "valid_filename.txt")]
|
||||
[InlineData("file<name>test.txt", "file<name>test.txt")]
|
||||
[InlineData("<>:\"|?*", "<>:\"|?*")]
|
||||
public void ReplaceInvalidFileNameChars_ValidFileName_UnchangedReturned(
|
||||
string fileName,
|
||||
string expected
|
||||
)
|
||||
[InlineData("file<name>test.txt", "file_name_test.txt")]
|
||||
[InlineData("<>:\"|?*", "_______")]
|
||||
public void ReplaceInvalidFileNameChars_Windows(string fileName, string expected)
|
||||
{
|
||||
var result = Utility.ReplaceInvalidFileNameChars(fileName);
|
||||
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
#else
|
||||
[Theory]
|
||||
[InlineData("valid_filename.txt", "valid_filename.txt")]
|
||||
[InlineData("file<name>test.txt", "file<name>test.txt")]
|
||||
[InlineData("<>:\"|?*", "<>:\"|?*")]
|
||||
public void ReplaceInvalidFileNameChars_NonWindows(string fileName, string expected)
|
||||
{
|
||||
var result = Utility.ReplaceInvalidFileNameChars(fileName);
|
||||
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
#region ToReadOnly Tests
|
||||
|
||||
Reference in New Issue
Block a user