So your test contains something like:
my %v = ReadIni( 'ReadConfig.ini' );
When you declare a relative file path it will be absolutified against $*CWD
. So if you run your test inside the t/
folder it will look for t/ReadConfig.ini
, and if you run it inside t/../
folder it will look for ../ReadConfig.ini
. Therefore when you are writing tests you should use absolutified paths such that tooling is not constrained to running tests inside a specific location.
my %v = ReadIni( $*PROGRAM.dirname.IO.add('ReadConfig.ini') );
On the other hand if you provide an absolute file path then there is no discrepancy in what is meant, and this will Do What You Mean regardless of what directory you are in. However I would suggest no using dirname
which does not include the volume portion on windows, and would instead use parent:
my %v = ReadIni( $*PROGRAM.parent.add('ReadConfig.ini') );
.dirname.IO.add
(up, then down), you can just say.sibling
(sideways). – Worthy