summaryrefslogtreecommitdiff
blob: a9e1bdb0b0220df7d3f1215d8f5eb11104f5c15e (plain)
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
From 0a67f501c8af5585af7fec08cbe0964b1a235b93 Mon Sep 17 00:00:00 2001
From: Peter Mottram <peter@sysnix.com>
Date: Thu, 12 May 2016 16:48:38 +0200
Subject: [PATCH] force header ordering in tests and ignore blank lines in
 diffs

This fixes effects of hash randomisation and line-break changes in
MIME::Lite.
---
 t/20create_image_part.t |  7 +++++++
 t/50generic.t           | 20 +++++++++++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/t/20create_image_part.t b/t/20create_image_part.t
index 0df935f..4de4440 100644
--- a/t/20create_image_part.t
+++ b/t/20create_image_part.t
@@ -8,6 +8,13 @@ use Cwd;
 
 # For create ref file, use perl -Iblib/lib t/20create_image_part.t 1
 
+MIME::Lite->field_order(
+    'mime-version',     'content-id',
+    'content-location', 'content-transfer-encoding',
+    'content-type',     'subject',
+    'to',               'from'
+);
+
 my $t = "/var/tmp/mime-lite-html-tests";
 my $p = cwd;
 my $o = (system("ln -s $p/t $t")==0);
diff --git a/t/50generic.t b/t/50generic.t
index 5ba7895..76b879d 100644
--- a/t/50generic.t
+++ b/t/50generic.t
@@ -10,6 +10,12 @@ use Cwd;
   URI::URL->strict(1);
 }
 
+MIME::Lite->field_order(
+    'mime-version',     'content-id',
+    'content-location', 'content-transfer-encoding',
+    'content-type',     'subject',
+    'to',               'from'
+);
 
 # For create ref file, use perl -Iblib/lib t/50generic.t 1
 
@@ -47,11 +53,11 @@ foreach my $it ('cid', 'location', 'extern') {
 	or die "Can't create $f.created_by_test:$!";
       print PROD $rep;
       close(PROD);
-    my $r = `diff $ref $f.created_by_test`;
+    my $r = `diff -B $ref $f.created_by_test`;
       cmp_ok($mailHTML->size, ">", (stat($ref))[7], "Same size");
       cmp_ok($mailHTML->size*0.945, "<", (stat($ref))[7], "Same size");
       is($r, "", $ref);
-      unlink("$f.created_by_test");
+      #unlink("$f.created_by_test");
     }
     # for create ref file
     elsif ($ARGV[0]) {
@@ -88,11 +94,11 @@ foreach my $it ('cid', 'location', 'extern') {
 	or die "Can't create $f.created_by_test:$!";
       print PROD $rep;
       close(PROD);
-    my $r = `diff $ref $f.created_by_test`;
+    my $r = `diff -B $ref $f.created_by_test`;
       cmp_ok($mailHTML->size, ">", (stat($ref))[7], "Same size");
       cmp_ok($mailHTML->size*0.945, "<", (stat($ref))[7], "Same size");
       is($r, "", $ref);
-      unlink("$f.created_by_test");
+      #unlink("$f.created_by_test");
     }
     # for create ref file
     elsif ($ARGV[0]) {
@@ -130,11 +136,11 @@ foreach my $it ('cid', 'location', 'extern') {
 	or die "Can't create $f.created_by_test:$!";
       print PROD $rep;
       close(PROD);
-    my $r = `diff $ref $f.created_by_test`;
+    my $r = `diff -B $ref $f.created_by_test`;
       cmp_ok($mailHTML->size, ">", (stat($ref))[7], "Same size");
       cmp_ok($mailHTML->size*0.945, "<", (stat($ref))[7], "Same size");
       is($r, "", $ref);
-      unlink("$f.created_by_test");
+      #unlink("$f.created_by_test");
     }
     # for create ref file
     elsif ($ARGV[0]) {
@@ -156,4 +162,4 @@ my $mailHTML = new MIME::Lite::HTML
 my %vars = ( 'perl' => 'fast', 'lng' => 'Ruby');
 cmp_ok($mailHTML->fill_template('Perl is <? $perl ?>, <? $lng ?> suck',\%vars),
        'eq', 'Perl is fast, Ruby suck',"Call of fill_template do his job");
-unlink($t);
+#unlink($t);