[libconfig-model-dpkg-perl] 07/08: test: replaced File::Slurp with Path::Tiny
dod at debian.org
dod at debian.org
Sun Jun 15 12:43:47 UTC 2014
This is an automated email from the git hooks/post-receive script.
dod pushed a commit to annotated tag debian/2.049
in repository libconfig-model-dpkg-perl.
commit 09af77b95b9a2754994af7e6e987d3b3b9d774e7
Author: Dominique Dumont <dod at debian.org>
Date: Sun Jun 15 14:36:43 2014 +0200
test: replaced File::Slurp with Path::Tiny
---
t/dpkg.t | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/t/dpkg.t b/t/dpkg.t
index 245f621..53dc0bd 100644
--- a/t/dpkg.t
+++ b/t/dpkg.t
@@ -5,8 +5,7 @@ use Test::More ;
use Test::Memory::Cycle;
use Config::Model ;
use Log::Log4perl qw(:easy) ;
-use File::Path ;
-use File::Copy ;
+use Path::Tiny ;
use Test::Warn ;
use Test::Exception ;
@@ -32,7 +31,6 @@ my ($log,$show) = (0) x 2 ;
my $do ;
my $trace = $arg =~ /t/ ? 1 : 0 ;
-$::debug = 1 if $arg =~ /d/;
$log = 1 if $arg =~ /l/;
$show = 1 if $arg =~ /s/;
$do = $1 if $arg =~ /(\d+)/;
@@ -54,15 +52,15 @@ Config::Model::Exception::Any->Trace(1) if $arg =~ /e/;
ok(1,"compiled");
# pseudo root where config files are written by config-model
-my $wr_root = 'wr_root';
+my $wr_root = path('wr_root');
# cleanup before tests
-rmtree($wr_root);
-mkpath($wr_root, { mode => 0755 }) ;
+$wr_root->remove_tree if $wr_root->exists;
+$wr_root->mkpath() ;
my $dpkg = $model->instance(
root_class_name => 'Dpkg',
- root_dir => $wr_root,
+ root_dir => $wr_root->stringify,
);
my $root = $dpkg->config_root ;
@@ -89,9 +87,9 @@ foreach my $t (@test) {
$dpkg->write_back ;
foreach my $f (keys %files) {
- my $test_file = "$wr_root/debian/$f" ;
- ok(-e $test_file ,"check that $f exists") ;
- my @lines = grep { ! /^#/ and /\w/ } read_file($test_file) ;
+ my $test_file = $wr_root->child('debian')->child($f) ;
+ ok($test_file->is_file ,"check that $f exists") ;
+ my @lines = grep { ! /^#/ and /\w/ } $test_file->lines ;
is(join('', at lines),$files{$f},"check $f content") ;
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git
More information about the Pkg-perl-cvs-commits
mailing list