summaryrefslogtreecommitdiff
path: root/t/50-icli.t
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2010-11-19 15:35:48 +0100
committerDaniel Friesel <derf@finalrewind.org>2010-11-19 15:35:48 +0100
commit226d3f5deb80ff1f0d4decae2642f5dd71ce0405 (patch)
treee1beff80315c9bf0419a8ff57f2f6e588df14503 /t/50-icli.t
parentfe50af6721b170e0929b4e79dfc289452530e242 (diff)
Add various tests for --filter
Diffstat (limited to 't/50-icli.t')
-rw-r--r--t/50-icli.t41
1 files changed, 40 insertions, 1 deletions
diff --git a/t/50-icli.t b/t/50-icli.t
index 7bf7d9b..6b3129a 100644
--- a/t/50-icli.t
+++ b/t/50-icli.t
@@ -3,7 +3,7 @@ use strict;
use warnings;
use 5.010;
-use Test::Command tests => (22*3);
+use Test::Command tests => (36*3);
my $icli = 'bin/icli -f t/in/status.dat -c t/in/objects.cache';
@@ -11,6 +11,19 @@ my $EMPTY = q{};
my $cmd = Test::Command->new(cmd => $icli);
+sub run_filter_test {
+ my ($prefix, $run, $filter) = @_;
+
+ my $file = $filter;
+ $file =~ tr/,//d;
+ $file =~ tr/!/./;
+
+ $cmd = Test::Command->new(cmd => "$icli $run -z $filter");
+ $cmd->exit_is_num(0);
+ $cmd->stdout_is_file("t/out/${prefix}_${file}");
+ $cmd->stderr_is_eq($EMPTY);
+}
+
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/standard');
$cmd->stderr_is_eq($EMPTY);
@@ -106,6 +119,32 @@ $cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq("See perldoc -F bin/icli\n");
+for my $filter (qw(
+ A
+ !A,!o
+ c
+ D
+ !o
+ !o,!A,!D
+ S
+ u
+ w
+ ))
+{
+ run_filter_test('filter', q{}, $filter);
+}
+
+for my $filter (qw(
+ d
+ !o
+ S
+ S,!x,!A
+ x
+ ))
+{
+ run_filter_test('h_filter', '-lh', $filter);
+}
+
$icli = "bin/icli -f t/in/status.dat.weird.1 -c t/in/objects.cache";