commit 135187172b1923a490a18c5a0f566d36d3e31054
parent 36effb2f66065edcc4a54fb11f76ee236e1a8e55
Author: Kyle Milz <kyle@0x30.net>
Date: Sun, 8 Jan 2017 03:04:46 -0700
t: convert check_spaces.sh to perl
Diffstat:
2 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/t/check_spaces.sh b/t/check_spaces.sh
@@ -1,13 +0,0 @@
-#!/bin/sh -u
-#
-# Verify citrun_check can handle paths with spaces when counting log file.
-#
-. t/utils.subr
-plan 2
-
-
-ok "are dirs with spaces in name created" mkdir dir\ a dir\ b
-echo "Found source file" > dir\ a/citrun.log
-echo "Found source file" > dir\ b/citrun.log
-ok "is citrun_check successful" citrun_check
-#ok "is citrun_check with path successful" citrun_check dir\ a/
diff --git a/t/check_spaces.t b/t/check_spaces.t
@@ -0,0 +1,26 @@
+#
+# Verify citrun_check can handle paths with spaces when counting log files.
+#
+use strict;
+use warnings;
+use Test::Cmd;
+use Test::More;
+
+plan skip_all => 'not impl on win32' if ($^O eq "MSWin32");
+plan tests => 3;
+
+my $output_good = "Summary:
+ 0 Source files used as input
+";
+
+my $check = Test::Cmd->new( prog => 'citrun_check', workdir => '' );
+
+mkdir File::Spec->catdir( $check->workdir, 'dir a' );
+mkdir File::Spec->catdir( $check->workdir, 'dir b' );
+$check->write( [ 'dir a', 'citrun.log' ], '' );
+$check->write( [ 'dir b', 'citrun.log' ], '' );
+
+$check->run( args => '', chdir => $check->curdir );
+is( $check->stdout, $output_good, 'is citrun_check stdout identical' );
+is( $check->stderr, '', 'is citrun_check stderr identical' );
+is( $? >> 8, 123, 'is citrun_check exit code 123' );