File: fix-test-suite.patch

package info (click to toggle)
libgraph-writer-graphviz-perl 0.11-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 172 kB
  • ctags: 113
  • sloc: perl: 1,385; makefile: 2
file content (139 lines) | stat: -rw-r--r-- 4,096 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
Description: Fix testsuite.
- 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).
  (iwj)
- Tests: Sort the keywords in the graph output
  They come out in hash order which is not necessarily stable.
  Fixes FTBFS with perl 5.18 (Debian #711446, CPAN #85950).
  (iwj)
- Tests: switch from dot to plain format
  GraphViz dot output has changed again, causing new build failures
  (Debian #755328).
  Use plain format instead of dot; textually comparing nested strings
  is just too fragile.
  Update t/TestUtils.pl's sorting fucntion.
  (gregoa)
Origin: vendor
Bug: http://rt.cpan.org/Public/Bug/Display.html?id=85950
Bug-Debian: https://bugs.debian.org/711446
 https://bugs.debian.org/755328
Forwarded: http://rt.cpan.org/Public/Bug/Display.html?id=85950
Author: Ian Jackson <ijackson@chiark.greenend.org.uk>
 gregor herrmann <gregoa@debian.org>
Last-Update: 2014-10-22

--- a/MANIFEST
+++ b/MANIFEST
@@ -14,3 +14,4 @@
 t/0.use.t
 t/1.simple.t
 t/2.ioall.t
+t/TestUtils.pl
--- a/t/1.simple.t
+++ b/t/1.simple.t
@@ -6,31 +6,27 @@
 use IO::All;
 use Graph;
 use Graph::Writer::GraphViz;
+require 't/TestUtils.pl';
 
 my @v = qw/Alice Bob Crude Dr/;
 my $g = Graph->new;
 $g->add_vertices(@v);
 
-my $wr = Graph::Writer::GraphViz->new(-format => 'dot');
+my $wr = Graph::Writer::GraphViz->new(-format => 'plain');
 $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');
 
 __DATA__
-digraph test {
-	graph [ratio=fill];
-	node [label="\N", color=black];
-	edge [color=black];
-	graph [bb="0,0,290,52"];
-	Bob [label=Bob, pos="27,26", width="0.75", height="0.50"];
-	Dr [label=Dr, pos="99,26", width="0.75", height="0.50"];
-	Alice [label=Alice, pos="174,26", width="0.83", height="0.50"];
-	Crude [label=Crude, pos="256,26", width="0.94", height="0.50"];
-}
+graph 1 4.3624 0.5
+node Crude 0.55065 0.25 1.1013 0.5 Crude solid ellipse black black
+node Dr 1.7312 0.25 0.75 0.5 Dr solid ellipse black black
+node Bob 2.759 0.25 0.79437 0.5 Bob solid ellipse black black
+node Alice 3.884 0.25 0.95686 0.5 Alice solid ellipse black black
+stop
--- a/t/2.ioall.t
+++ b/t/2.ioall.t
@@ -6,12 +6,13 @@
 use IO::All;
 use Graph;
 use Graph::Writer::GraphViz;
+require 't/TestUtils.pl';
 
 my @v = qw/Alice Bob Crude Dr/;
 my $g = Graph->new;
 $g->add_vertices(@v);
 
-my $wr = Graph::Writer::GraphViz->new(-format => 'dot');
+my $wr = Graph::Writer::GraphViz->new(-format => 'plain');
 my $io = io('t/graph.ioall.dot')->mode('w+')->assert;
 $wr->write_graph($g, $io );
 
@@ -25,20 +26,16 @@
 }
 
 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;
 
 __DATA__
-digraph test {
-	graph [ratio=fill];
-	node [label="\N", color=black];
-	edge [color=black];
-	graph [bb="0,0,290,52"];
-	Bob [label=Bob, pos="27,26", width="0.75", height="0.50"];
-	Dr [label=Dr, pos="99,26", width="0.75", height="0.50"];
-	Alice [label=Alice, pos="174,26", width="0.83", height="0.50"];
-	Crude [label=Crude, pos="256,26", width="0.94", height="0.50"];
-}
+graph 1 4.3624 0.5
+node Crude 0.55065 0.25 1.1013 0.5 Crude solid ellipse black black
+node Dr 1.7312 0.25 0.75 0.5 Dr solid ellipse black black
+node Bob 2.759 0.25 0.79437 0.5 Bob solid ellipse black black
+node Alice 3.884 0.25 0.95686 0.5 Alice solid ellipse black black
+stop
--- /dev/null
+++ b/t/TestUtils.pl
@@ -0,0 +1,11 @@
+
+sub launder ($) {
+    my ($gr) = @_;
+    # Ignore font-sizes, it's system-dependant
+    $$gr =~ s/\d+/0/g;
+    # Sort the the graph output, as it comes out
+    # in hash order which isn't necessarily stable.
+    $$gr = join "\n", sort split /\n/, $$gr;
+}
+
+1;