commit 1cf0dfa942ed8eca9d3f620e8dc267bce8ff70e2
parent 31fac257a7b0d2b3bd34ab6cf0e715335ed8121b
Author: Kyle Milz <kyle@windows.krwm.net>
Date: Wed, 4 Jan 2017 17:44:42 -0800
t: deduplicate some os independent stuff
Diffstat:
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/t/wrap_exitcode.t b/t/wrap_exitcode.t
@@ -8,21 +8,16 @@ use Test::More tests => 3;
my $wrap = Test::Cmd->new( prog => 'citrun_wrap', workdir => '' );
+my $err_good;
if ($^O eq "MSWin32") {
- my $err_good = "Cannot access file C:\\Users\\kyle\\citrun\\asdf
-";
$wrap->run( args => 'more.com asdf' );
-
- is( $wrap->stdout, '', 'is citrun_wrap stdout empty');
- is( $wrap->stderr, $err_good, 'is citrun_wrap stderr identical');
- is( $? >> 8, 1, 'is citrun_wrap exit code 1');
+ $err_good = 'Cannot access file .*asdf';
}
else {
$wrap->run( args => 'ls asdf' );
- my $err_good = "ls: asdf: No such file or directory
-";
-
- is( $wrap->stdout, '', 'is citrun_wrap stdout empty');
- is( $wrap->stderr, $err_good, 'is citrun_wrap stderr identical');
- is( $? >> 8, 1, 'is citrun_wrap exit code 1');
+ $err_good = "ls: asdf: No such file or directory";
}
+
+is( $wrap->stdout, '', 'is citrun_wrap stdout empty');
+like( $wrap->stderr, qr/$err_good/, 'is citrun_wrap stderr identical');
+is( $? >> 8, 1, 'is citrun_wrap exit code 1');