[fpc-pascal] TPath enhancements (Issue #40513): can somebody test with Delphi 12?y

Bart bartjunk64 at gmail.com
Sun Nov 19 16:10:48 CET 2023


Put a new implementation in the bugreport.
Did not test the "wah is an illegal chatacter", IMO that should be a
seperate issue.

Currently based upon these rules:

{
  Concatenates the paths.
  If one or more of the paths is absolute, it will use the right most
absolute path as
  base path and then concatenates the remaining paths to that.
  E.g. ['\a','b','\c','d'] will return '\c\d';
  If ValidateParam is True, and any of the paths contains an invalid
path character
  an exception is raised.
  No checks are done wether or not a given paths exists.
  E.g. ['\a','b','\c:'] will hapilly return the non-sensical path '\c:'
}


My tests now give these results:

OK:   ['']: Got: '', Expected: ''
OK:   ['','']: Got: '', Expected: ''
OK:   ['','','']: Got: '', Expected: ''
OK:   ['a','b','c']: Got: 'a\b\c', Expected: 'a\b\c'
OK:   ['a','b','\c']: Got: '\c', Expected: '\c'
OK:   ['a','\b','c']: Got: '\b\c', Expected: '\b\c'
OK:   ['\a','\b','c']: Got: '\b\c', Expected: '\b\c'
OK:   ['\a','\b','\c']: Got: '\c', Expected: '\c'
OK:   ['\a','b','\c:']: Got: '\c:', Expected: '\c:'
OK:   ['a','<>','\b','c','\d'] --> EArgumentException, (as expected)
FAIL: ['c:','a','b']: Got: 'c:\a\b', Expected: '?'  <== don't know
what the expected value should be here

NOT ValidateParams
OK:   ['']: Got: '', Expected: ''
OK:   ['','']: Got: '', Expected: ''
OK:   ['','','']: Got: '', Expected: ''
OK:   ['a','b','c']: Got: 'a\b\c', Expected: 'a\b\c'
OK:   ['a','b','\c']: Got: '\c', Expected: '\c'
OK:   ['a','\b','c']: Got: '\b\c', Expected: '\b\c'
OK:   ['\a','\b','c']: Got: '\b\c', Expected: '\b\c'
OK:   ['\a','\b','\c']: Got: '\c', Expected: '\c'
OK:   ['\a','b','\c:']: Got: '\c:', Expected: '\c:'
OK:   ['a','<>','\b','c','\d']: Got: '\d', Expected: '\d'

--
Bart


More information about the fpc-pascal mailing list