[libgraph-writer-graphviz-perl] 02/05: Tests: Provide a TestUtils.pl containing broken-out launder() function
gregor herrmann
gregoa at debian.org
Sat Feb 8 19:57:42 UTC 2014
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to annotated tag debian/0.11-1nmu1
in repository libgraph-writer-graphviz-perl.
commit bcedbb978208ce08d35e8f317fed5b34695ac1ab
Author: Ian Jackson <ijackson at chiark.greenend.org.uk>
Date: Sat Feb 8 17:18:34 2014 +0000
Tests: Provide a TestUtils.pl containing broken-out launder() function
The code for laundering font sizes was duplicated between the tests.
Instead, break it out into a common function launder() in a new file
t/TestUtils.pl (which exists just for the tests).
Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
squash! Tests: Provide a Test.pm containing
---
MANIFEST | 1 +
t/1.simple.t | 6 +++---
t/2.ioall.t | 7 ++++---
t/TestUtils.pl | 8 ++++++++
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/MANIFEST b/MANIFEST
index 749c521..68c47e7 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -14,3 +14,4 @@ README
t/0.use.t
t/1.simple.t
t/2.ioall.t
+t/TestUtils.pl
diff --git a/t/1.simple.t b/t/1.simple.t
index 952a07b..66fb1e2 100644
--- a/t/1.simple.t
+++ b/t/1.simple.t
@@ -6,6 +6,7 @@ use Test::Simple tests => 1;
use IO::All;
use Graph;
use Graph::Writer::GraphViz;
+require 't/TestUtils.pl';
my @v = qw/Alice Bob Crude Dr/;
my $g = Graph->new;
@@ -17,9 +18,8 @@ $wr->write_graph($g,'t/graph.simple.dot');
$/ = undef;
my $g1 = <DATA>;
my $g2 = io('t/graph.simple.dot')->slurp;
-# Ignore font-sizes, it's system-dependant
-$g1 =~ s/\d+/0/g;
-$g2 =~ s/\d+/0/g;
+launder(\$g1);
+launder(\$g2);
ok($g1 eq $g2);
unlink('t/graph.simple.dot');
diff --git a/t/2.ioall.t b/t/2.ioall.t
index f18fff8..a489445 100644
--- a/t/2.ioall.t
+++ b/t/2.ioall.t
@@ -6,6 +6,7 @@ use Test::Simple tests => 2;
use IO::All;
use Graph;
use Graph::Writer::GraphViz;
+require 't/TestUtils.pl';
my @v = qw/Alice Bob Crude Dr/;
my $g = Graph->new;
@@ -25,9 +26,9 @@ $g2 = $io->slurp;
}
ok(-f 't/graph.ioall.dot');
-# Ignore font-sizes, it's system-dependant
-$g1 =~ s/\d+/0/g;
-$g2 =~ s/\d+/0/g;
+
+launder(\$g1);
+launder(\$g2);
ok($g1 eq $g2);
$io->unlink;
diff --git a/t/TestUtils.pl b/t/TestUtils.pl
new file mode 100644
index 0000000..4fec3d3
--- /dev/null
+++ b/t/TestUtils.pl
@@ -0,0 +1,8 @@
+
+sub launder ($) {
+ my ($gr) = @_;
+ # Ignore font-sizes, it's system-dependant
+ $$gr =~ s/\d+/0/g;
+}
+
+1;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libgraph-writer-graphviz-perl.git
More information about the Pkg-perl-cvs-commits
mailing list