Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use 5.006; | ||
use strict; | ||
use warnings; | ||
use Test::More 0.96; | ||
use File::Temp; | ||
|
||
{ | ||
package Foo; | ||
use Moose; | ||
use MooseX::Types::Path::Class::MoreCoercions qw/Dir File/; | ||
|
||
has temp_file => ( is => 'ro', isa => File, coerce => 1 ); | ||
has temp_dir => ( is => 'ro', isa => Dir, coerce => 1 ); | ||
} | ||
|
||
my $tf = File::Temp->new; | ||
my $td = File::Temp->newdir; | ||
|
||
my $obj = eval { | ||
Foo->new( | ||
temp_file => $tf, | ||
temp_dir => $td, | ||
) | ||
}; | ||
|
||
is( $@, '', "object created without exception" ); | ||
|
||
isa_ok( $obj->temp_file, "Path::Class::File", "temp_file" ); | ||
isa_ok( $obj->temp_dir, "Path::Class::Dir", "temp_dir" ); | ||
is( $obj->temp_file, $tf, "temp_file set correctly" ); | ||
is( $obj->temp_dir, $td, "temp_dir set correctly" ); | ||
|
||
done_testing; | ||
# COPYRIGHT |