Fixing a single hard-coded path in a test in App::Cmd: The saga continues

So, I ranted a little. That reduced my stress levels, and I decided to get back to fixing a single line in t/basic.t in App::Cmd.

 C:\…\App-Cmd> dzil test
Required plugin Dist::Zilla::PluginBundle::RJBS isn't installed.

Run 'dzil authordeps' to see a list of all required plugins.
You can pipe the list to your CPAN client to install or update them:

    dzil authordeps --missing | cpanm

Of course, C:\…\App-Cmd> dzil authordeps --missing is actually less than informative:

Dist::Zilla::PluginBundle::RJBS

I am assuming Dist::Zilla::Plugin::Git failed because I didn’t have git in my %PATH%. So, I’ll fix that when everything else installs. …

I know I should not be whining, but it is frustrating that I am only going through this because I want to fix a hard coded path in test case, and I want to make it easy on the people whose work I use and appreciate.

I know that’s asinine, but it is frustrating:

And, after that, I get this:

t/commit-build-src-as-parent.t .. 2/8 ssh: Could not resolve hostname c: Name or service not known fatal: Could not read from remote repository.

There is now a weird directory in the build directory.

*Sigh*

Force install time again.

With that out of the way, Dist::Zilla::Plugin::GithubMeta has an issue with the fact that I have a github entry in my $HOME/.ssh/config.

But, at least, dzil test now runs:

Test Summary Report
-------------------
t\basic.t            (Wstat: 256 Tests: 15 Failed: 1)
  Failed test:  7
  Non-zero exit status: 1
Files=16, Tests=71,  6 wallclock secs ( 0.17 usr +  0.03 sys =  0.20 CPU)
Result: FAIL
Failed 1/16 test programs. 1/71 subtests failed.
NMAKE : fatal error U1077: 'C:\opt\perl-5.20.1\bin\perl.exe' : return code '0xff'
Stop.
error running nmake test

After a simple change:

All tests successful.
Files=16, Tests=71,  6 wallclock secs ( 0.16 usr +  0.03 sys =  0.19 CPU)
Result: PASS
[DZ] all's well; removing .build\f9Nt2pIEe5

And, this is the change:

C:\…\App-Cmd> git diff
diff --git a/t/basic.t b/t/basic.t
index 558d8cb..30fb907 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -3,6 +3,7 @@
 use strict;
 use warnings;

+use File::Spec;
 use Test::More tests => 15;
 use App::Cmd::Tester;

@@ -67,7 +68,10 @@ is_deeply(
 }

 my $return = test_app('Test::MyCmd', [ qw(--version) ]);
-my $version_expect = "basic.t (Test::MyCmd) version 0.123 (t/basic.t)\n";
+my $version_expect = sprintf(
+    "basic.t (Test::MyCmd) version 0.123 (%s)\n",
+    File::Spec->catfile(t => 'basic.t'),
+);
 is($return->stdout, $version_expect, "version plugin enabled");

 $return = test_app('Test::MyCmd', [ qw(commands) ]);

Here is the pull request, finally.

Now, I need to go back and submit patches for some of the other problems I encountered during this saga.

PS: David Golden please note:

I don’t want to sound ungrateful right after Thanksgiving, but, it could have been a little easier to submit that bug fix. I also think RJBS does know better than to hard-code paths without regard to portability. In fact, I would assume the authors of all the modules whose tests hard code various paths, and interpolate strings into regex patterns know better. I am at a bit of a loss for words, frankly.

I started down this path because I wanted to cpanm Dancer2 which failed because of the hard-coded path in a test in App::Cmd. And, Dancer2 still has not been installed.