Add test for strange --version handling
[gitmo/MooseX-Getopt.git] / t / version_with_options.pl
diff --git a/t/version_with_options.pl b/t/version_with_options.pl
new file mode 100644 (file)
index 0000000..d3c7916
--- /dev/null
@@ -0,0 +1,24 @@
+package WithOptions;
+use Moose;
+
+with 'MooseX::Getopt';
+
+has print_version => (
+    traits        => [qw(Getopt)],
+    isa           => 'Bool',
+    is            => 'ro',
+    cmd_flag      => 'version',
+    cmd_aliases   => 'v',
+);
+
+sub run {
+    my ($self) = @_;
+
+    if ($self->print_version) {
+        print "SUCCESS\n";
+        exit;
+    }
+}
+
+package main;
+WithOptions->new_with_options;