Skip to content

Commit 92be66e

Browse files
committed
Test that 'do_system' passes args to 'system' correctly
1 parent bea2057 commit 92be66e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

t/do_system.t

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env perl
2+
use strict;
3+
use warnings;
4+
use Test::More tests => 2;
5+
6+
# test that 'do_system' wraps 'system' correctly
7+
8+
our @system;
9+
BEGIN {
10+
*CORE::GLOBAL::system = sub { @system = @_; };
11+
}
12+
use App::perlbrew;
13+
14+
# don't actually run() it, we just want to call do_system
15+
my $app = App::perlbrew->new('list');
16+
17+
$app->do_system(qw(perl -E), 'say 42');
18+
is_deeply \@system, [qw(perl -E), 'say 42'], 'passed all arguments to system()';
19+
20+
$app->do_system("perl -e 'say 42'");
21+
is_deeply \@system, ["perl -e 'say 42'"], 'passed single string to system()';

0 commit comments

Comments
 (0)