File: 13-sudo.t

package info (click to toggle)
libgit-repository-perl 1.325-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 376 kB
  • sloc: perl: 661; makefile: 7
file content (27 lines) | stat: -rw-r--r-- 653 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
use strict;
use warnings;
use Test::More;
use Test::Requires::Git;
use Test::Git;
use File::Spec;

plan tests => 3;

# test using a wrapper
my $sudo = File::Spec->catfile( t => 'sudo.pl' );
my $out = Git::Repository->run( qw( a b ), { git => [ $^X, $sudo, 'git' ] } );
is( $out, 'git a b', 'wrapper called correctly' );

# same wrapper, but to something that fails to identify as git
ok( !eval {
        $out = Git::Repository->run( qw( a b ),
            { git => [ $^X, $sudo, 'meh' ] } );
    },
    'sudo meh fails to pass for sudo git'
);
like(
    $@,
    qr/^git binary '.*meh' not available or broken/,
    '... with expected error message'
);