Subject: | Spurious test failure due to hard coded test file name |
With nmake, `\` are used as directory separators in paths. Therefore, `nmake test` fails with:
t\Carp.t ............. 1/60
# Failed test 'we don't overshoot the top stack frame'
# at t\Carp.t line 32.
# got: 'foo at t\Carp.t line 31.
# '
# expected: 'foo at t/Carp.t line 31.
# '
# Looks like you failed 1 test of 60.
Therefore:
31: my $str = Carp::longmess("foo");
is(
$str,
"foo at t/Carp.t line 31.\n",
"we don't overshoot the top stack frame",
);
should be
31: my $str = Carp::longmess("foo");
is(
$str,
"foo at $0 line 31.\n",
"we don't overshoot the top stack frame",
);
or even
31: my $line = __LINE__, my $str = Carp::longmess("foo");
is(
$str,
"foo at $0 line $line.\n",
"we don't overshoot the top stack frame",
);
to avoid further hard coding of information that may change.
HTH,
-- Sinan