File: git_binary.t

package info (click to toggle)
libgit-wrapper-perl 0.037-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 232 kB
  • ctags: 55
  • sloc: perl: 451; makefile: 6
file content (31 lines) | stat: -rwxr-xr-x 922 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl

use strict;
use warnings;
use Test::More;
use Test::Exception;

use File::Temp qw(tempdir);
use Git::Wrapper;

my $dir = tempdir(CLEANUP => 1);

{
  my $git = Git::Wrapper->new({ dir        => $dir ,
                                git_binary => 'echo' });

  my @got = $git->RUN('marco');
  # apparently some versions of windows include extra bonus whitespace, so the
  # simple way of testing this fails sometimes. so...
  is( scalar @got , 1 , 'only get one line' );
  like( $got[0] , qr/^marco\s*$/ , 'Wrapper runs what ever binary we tell it to' );
}

{
  dies_ok { my $git = Git::Wrapper->new() } 'need a dir';
  dies_ok { my $git = Git::Wrapper->new(['foo']) } 'need to call properly';
  dies_ok { my $git = Git::Wrapper->new([dir => 'foo']) } 'no, really, need to call properly';
  dies_ok { my $git = Git::Wrapper->new({ git_binary => "$dir/echo" }) } 'just git_binary fails';
}

done_testing();