protect @INC when re-invoking
[gitmo/MooseX-Runnable.git] / t / reverse-args.t
1 use strict;
2 use warnings;
3 use Test::More tests => 1;
4
5 use MooseX::Runnable::Util::ArgParser;
6
7 my $str = '-MFoo -Ilib -MBar +Plugout +Plugin --with-args -- MyApp --with  args';
8
9 my $args = MooseX::Runnable::Util::ArgParser->new(
10     argv => [split ' ', $str],
11 );
12
13 local $^X = '/path/to/perl';
14 local $FindBin::Bin = '/path/to';
15 local $FindBin::Script = 'mx-run';
16 local @INC = ('foobar');
17 my @cmdline = $args->guess_cmdline(
18     perl_flags => ['--X--'],
19     without_plugins => ['Plugout'],
20 );
21
22 is join(' ', @cmdline),
23   "/path/to/perl -Ifoobar --X-- /path/to/mx-run -Ilib -MFoo -MBar +Plugin --with-args -- MyApp --with args",
24   'cmdline reverses reasonably';