add ability to generate commandline from parsed arg object
[gitmo/MooseX-Runnable.git] / t / reverse-args.t
diff --git a/t/reverse-args.t b/t/reverse-args.t
new file mode 100644 (file)
index 0000000..4b0086e
--- /dev/null
@@ -0,0 +1,23 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+use MooseX::Runnable::Util::ArgParser;
+
+my $str = '-MFoo -Ilib -MBar +Plugout +Plugin --with-args -- MyApp --with  args';
+
+my $args = MooseX::Runnable::Util::ArgParser->new(
+    argv => [split ' ', $str],
+);
+
+local $^X = '/path/to/perl';
+local $FindBin::Bin = '/path/to';
+local $FindBin::Script = 'mx-run';
+my @cmdline = $args->guess_cmdline(
+    perl_flags => ['--X--'],
+    without_plugins => ['Plugout'],
+);
+
+is join(' ', @cmdline),
+  "/path/to/perl --X-- /path/to/mx-run -Ilib -MFoo -MBar +Plugin --with-args -- MyApp --with args",
+  'cmdline reverses reasonably';