diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-06-22 12:02:03 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-06-22 12:02:03 -0500 |
commit | 3669b3d498f2f6224b8dc8cdc8cfcca1c0165611 (patch) | |
tree | bc877d68dde1228eecd2978f6992d95ade4d4c71 /t/lib | |
parent | 51cc7663854af4760274c378c339e16a8eff65ab (diff) | |
download | plack-middleware-class-refresh-3669b3d498f2f6224b8dc8cdc8cfcca1c0165611.tar.gz plack-middleware-class-refresh-3669b3d498f2f6224b8dc8cdc8cfcca1c0165611.zip |
initial implementation
Diffstat (limited to 't/lib')
-rw-r--r-- | t/lib/Test/PMCR.pm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/t/lib/Test/PMCR.pm b/t/lib/Test/PMCR.pm new file mode 100644 index 0000000..c3d930c --- /dev/null +++ b/t/lib/Test/PMCR.pm @@ -0,0 +1,35 @@ +package Test::PMCR; +use strict; +use warnings; + +use File::Copy; +use File::Find; +use File::Spec::Functions 'abs2rel', 'catdir'; +use File::Temp 'tempdir'; + +sub setup_temp_dir { + my ($test) = @_; + + my $dir = tempdir(CLEANUP => 1); + + lib->import($dir); + + my $from_base = catdir(qw(t data), $test); + find(sub { + return if $_ eq '.'; + if (-d) { + my $from = abs2rel($File::Find::name, $from_base); + my $to = catdir($dir, $from); + mkdir($to) || die "couldn't mkdir: $!"; + } + else { + my $from = abs2rel($File::Find::name, $from_base); + my $to = catdir($dir, $from); + copy($_, $to) || die "couldn't copy: $!"; + } + }, $from_base); + + return $dir; +} + +1; |