Skip to content

Commit

Permalink
Added simple output test
Browse files Browse the repository at this point in the history
  • Loading branch information
creaktive committed Oct 19, 2013
1 parent 9f7ec50 commit e28a44b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ perlcritic.rc
rainbarf
README
t/00-compile.t
t/01-tmux.t
t/author-critic.t
t/author-test-eol.t
t/release-cpan-changes.t
Expand Down
58 changes: 58 additions & 0 deletions t/01-tmux.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!perl
use strict;
use utf8;
use warnings qw(all);

use File::Temp;
use Test::More;

plan skip_all => q(I'm pretty sure rainbarf will not run on Windows)
if $^O =~ m{^(?:MSWin\d+|cygwin)$}ix;

my $tmp = File::Temp->newdir;

local $ENV{RAINBARF} = q(/dev/null);
local $ENV{HOME} = $tmp->dirname;

my $n = 10;

my $color_set = qr{
\#\[
fg=\w+
(?:,bg=\w+)?
\]
}x;
my $color_reset = qr{
\#\[
(?:[bf]g=default,?) {2}
\]
}x;
my $chart = qr{
[\x{2581}-\x{2588}]+
}x;

for my $i (1 .. $n) {
ok(
open(my $out, q(-|:encoding(utf8)), qw[rainbarf --nobattery --swap --tmux]),
qq(pipe $i),
);
chomp(my $line = <$out>);
close $out;
like(
$line,
qr{
^
(?:
$color_set
$chart
) {2,5}
$color_reset
$
}msx,
qq(pattern $i),
);

sleep 1;
}

done_testing 2 * $n;

0 comments on commit e28a44b

Please sign in to comment.