@@ -341,11 +341,8 @@ public void WindowsAlternateDataStream_OnExisting(string streamName)
341341 }
342342 }
343343
344- [ Theory ]
345- [ InlineData ( " leading" ) ]
346- [ InlineData ( " leading" ) ]
347- [ InlineData ( " leading" ) ]
348- public void LeadingSpace ( string fileName )
344+ [ Theory , MemberData ( nameof ( TestData . ValidFileNames ) , MemberType = typeof ( TestData ) ) ]
345+ public void CreateWithProblematicNames ( string fileName )
349346 {
350347 DirectoryInfo testDir = Directory . CreateDirectory ( GetTestFilePath ( ) ) ;
351348 string filePath = Path . Combine ( testDir . FullName , fileName ) ;
@@ -355,42 +352,9 @@ public void LeadingSpace(string fileName)
355352 }
356353 }
357354
358- [ Theory ]
359- [ InlineData ( ".leading" ) ]
360- [ InlineData ( "..leading" ) ]
361- [ InlineData ( "...leading" ) ]
362- public void LeadingDot ( string fileName )
363- {
364- DirectoryInfo testDir = Directory . CreateDirectory ( GetTestFilePath ( ) ) ;
365- string filePath = Path . Combine ( testDir . FullName , fileName ) ;
366- using ( Create ( filePath ) )
367- {
368- Assert . True ( File . Exists ( filePath ) ) ;
369- }
370- }
371-
372- [ Theory ]
373- [ InlineData ( "-" ) ]
374- [ InlineData ( "--" ) ]
375- [ InlineData ( "-filename" ) ]
376- [ InlineData ( "--filename" ) ]
377- public void DashPrefixedNames ( string fileName )
378- {
379- DirectoryInfo testDir = Directory . CreateDirectory ( GetTestFilePath ( ) ) ;
380- string filePath = Path . Combine ( testDir . FullName , fileName ) ;
381- using ( Create ( filePath ) )
382- {
383- Assert . True ( File . Exists ( filePath ) ) ;
384- }
385- }
386-
387- [ Theory ]
388- [ InlineData ( "file\t name" ) ]
389- [ InlineData ( "file\r name" ) ]
390- [ InlineData ( "file\v name" ) ]
391- [ InlineData ( "file\f name" ) ]
355+ [ Theory , MemberData ( nameof ( TestData . UnixOnlyFileNames ) , MemberType = typeof ( TestData ) ) ]
392356 [ PlatformSpecific ( TestPlatforms . AnyUnix ) ]
393- public void UnixEmbeddedControlCharacters ( string fileName )
357+ public void UnixCreateWithControlCharacters ( string fileName )
394358 {
395359 DirectoryInfo testDir = Directory . CreateDirectory ( GetTestFilePath ( ) ) ;
396360 string filePath = Path . Combine ( testDir . FullName , fileName ) ;
@@ -401,16 +365,13 @@ public void UnixEmbeddedControlCharacters(string fileName)
401365 }
402366
403367 [ ConditionalTheory ( nameof ( UsingNewNormalization ) ) ]
404- [ InlineData ( "trailing " ) ]
405- [ InlineData ( "trailing " ) ]
406- [ InlineData ( "trailing." ) ]
407- [ InlineData ( "trailing.." ) ]
408- [ InlineData ( "trailing ." ) ]
409- [ InlineData ( "trailing. " ) ]
368+ [ MemberData ( nameof ( TestData . WindowsTrailingProblematicFileNames ) , MemberType = typeof ( TestData ) ) ]
410369 [ PlatformSpecific ( TestPlatforms . Windows ) ]
411- public void WindowsTrailingSpacePeriod_CreateViaExtendedSyntax ( string fileName )
370+ public void WindowsCreateWithTrailingSpacePeriod ( string fileName )
412371 {
413- // Files with trailing spaces/periods require \\?\ syntax on Windows
372+ // On Windows, files with trailing spaces/periods must be created using \\?\ prefix.
373+ // This is by design - Windows path normalization strips these characters unless
374+ // the extended path syntax is used. See TrimmedPaths.cs for more detailed tests.
414375 DirectoryInfo testDir = Directory . CreateDirectory ( GetTestFilePath ( ) ) ;
415376 string filePath = Path . Combine ( testDir . FullName , fileName ) ;
416377 string extendedPath = @"\\?\" + filePath ;
@@ -420,40 +381,11 @@ public void WindowsTrailingSpacePeriod_CreateViaExtendedSyntax(string fileName)
420381 Assert . True ( File . Exists ( extendedPath ) ) ;
421382 }
422383
423- // Verify we can find it via enumeration
384+ // Verify the file can be found via enumeration
424385 string [ ] files = Directory . GetFiles ( testDir . FullName ) ;
425386 Assert . Contains ( files , f => Path . GetFileName ( f ) == fileName ) ;
426387 }
427388
428- [ Theory ]
429- [ InlineData ( "name with spaces" ) ]
430- [ InlineData ( "name with multiple spaces" ) ]
431- [ InlineData ( "name.with.periods" ) ]
432- [ InlineData ( "name with spaces.txt" ) ]
433- public void EmbeddedSpacesPeriods ( string fileName )
434- {
435- // Embedded spaces and periods should work fine on all platforms
436- DirectoryInfo testDir = Directory . CreateDirectory ( GetTestFilePath ( ) ) ;
437- string filePath = Path . Combine ( testDir . FullName , fileName ) ;
438- using ( Create ( filePath ) )
439- {
440- Assert . True ( File . Exists ( filePath ) ) ;
441- }
442- }
443-
444- [ Theory ]
445- [ InlineData ( "name\t with\t tabs" ) ]
446- [ PlatformSpecific ( TestPlatforms . AnyUnix ) ]
447- public void UnixEmbeddedTabs ( string fileName )
448- {
449- DirectoryInfo testDir = Directory . CreateDirectory ( GetTestFilePath ( ) ) ;
450- string filePath = Path . Combine ( testDir . FullName , fileName ) ;
451- using ( Create ( filePath ) )
452- {
453- Assert . True ( File . Exists ( filePath ) ) ;
454- }
455- }
456-
457389 #endregion
458390 }
459391
0 commit comments