scope the classes
[gitmo/MooseX-Types-Path-Class.git] / t / 01.basic.t
index 01cb366..fa0b1a7 100644 (file)
@@ -2,49 +2,53 @@
 use warnings FATAL => 'all';
 use strict;
 
-package Foo;
-use Moose;
-with 'MooseX::Getopt';
-use MooseX::Types::Path::Class;
+{
 
-has 'dir' => (
-    is       => 'ro',
-    isa      => 'Path::Class::Dir',
-    required => 1,
-    coerce   => 1,
-);
+    package Foo;
+    use Moose;
+    use MooseX::Types::Path::Class;
 
-has 'file' => (
-    is       => 'ro',
-    isa      => 'Path::Class::File',
-    required => 1,
-    coerce   => 1,
-);
+    has 'dir' => (
+        is       => 'ro',
+        isa      => 'Path::Class::Dir',
+        required => 1,
+        coerce   => 1,
+    );
+
+    has 'file' => (
+        is       => 'ro',
+        isa      => 'Path::Class::File',
+        required => 1,
+        coerce   => 1,
+    );
+}
+
+{
 
-package Bar;
-use Moose;
-with 'MooseX::Getopt';
-use MooseX::Types::Path::Class qw( Dir File );
+    package Bar;
+    use Moose;
+    use MooseX::Types::Path::Class qw( Dir File );
 
-has 'dir' => (
-    is       => 'ro',
-    isa      => Dir,
-    required => 1,
-    coerce   => 1,
-);
+    has 'dir' => (
+        is       => 'ro',
+        isa      => Dir,
+        required => 1,
+        coerce   => 1,
+    );
 
-has 'file' => (
-    is       => 'ro',
-    isa      => File,
-    required => 1,
-    coerce   => 1,
-);
+    has 'file' => (
+        is       => 'ro',
+        isa      => File,
+        required => 1,
+        coerce   => 1,
+    );
+}
 
 package main;
 
 use Test::More;
 use Path::Class;
-plan tests => 20;
+plan tests => 10;
 
 my $dir = dir('', 'tmp');
 my $file = file('', 'tmp', 'foo');
@@ -58,19 +62,7 @@ my $check = sub {
 };
 
 for my $class (qw(Foo Bar)) {
-    my $o;
-
-#    $o = $class->new( dir => '/tmp', file => [ '', 'tmp', 'foo' ] );
-    $o = $class->new( dir => "$dir", file => [ '', 'tmp', 'foo' ] );
-    isa_ok( $o, $class );
-    $check->($o);
-    @ARGV = qw(
-        --dir
-        /tmp
-        --file
-        /tmp/foo
-    );
-    $o = $class->new_with_options;
+    my $o = $class->new( dir => "$dir", file => [ '', 'tmp', 'foo' ] );
     isa_ok( $o, $class );
     $check->($o);
 }