From e3dcd8fd04cee023663a36a5fa4882b6d210ca6e Mon Sep 17 00:00:00 2001
From: Robin Jarry <robin@jarry.cc>
Date: Thu, 25 Aug 2022 18:46:00 +0200
Subject: [PATCH] tests: fix corrupted date header in sample messages

Two sample email files in test/testdata contain corrupted date headers.
Since go 1.19, this invalid date format is somehow parsed successfully.
With go 1.18 and earlier, the parsing fails and Email.GetDate() returns
time.Unix(0, 0) (from jwz_test.go).

This causes the order of threads to be different in go 1.19 and causes
the unit tests to fail.

  --- FAIL: ExampleSort (0.08s)
  got:
  First node subject: 2002-02-01 05:44:14 +0000 UTC : Please help a newbie compile mplayer :-)
  want:
  First node subject: 1970-01-01 00:00:00 +0000 UTC : Re: My source: RE: A biblical digression :: node synthesized by https://gatherstars.com/

Fix the corrupted date headers and adjust unit test expected result
accordingly.

Link: https://github.com/golang/go/commit/3ef8562c9c2c7
Signed-off-by: Robin Jarry <robin@jarry.cc>
---
 test/testdata/ham/0359.7f80dc1df7de3b5121e43f29f0a9e911.eml | 2 +-
 test/testdata/ham/0361.36332081025aaf122520737c26461a88.eml | 2 +-
 utils_test.go                                               | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/testdata/ham/0359.7f80dc1df7de3b5121e43f29f0a9e911.eml b/test/testdata/ham/0359.7f80dc1df7de3b5121e43f29f0a9e911.eml
index aba7568033ab..963be7aa36f0 100644
--- a/test/testdata/ham/0359.7f80dc1df7de3b5121e43f29f0a9e911.eml
+++ b/test/testdata/ham/0359.7f80dc1df7de3b5121e43f29f0a9e911.eml
@@ -47,7 +47,7 @@ List-Id: Friends of Rohit Khare <fork.xent.com>
 List-Unsubscribe: <http://xent.com/mailman/listinfo/fork>,
     <mailto:fork-request@xent.com?subject=unsubscribe>
 List-Archive: <http://xent.com/pipermail/fork/>
-Date: Sun, 25 Aug 2002 16:50:54 UT
+Date: Sun, 25 Aug 2002 16:50:54 UTC
 X-Pyzor: Reported 0 times.
 X-Spam-Status: No, hits=-5.6 required=7.0
 	tests=KNOWN_MAILING_LIST,QUOTED_EMAIL_TEXT,SIGNATURE_SHORT_DENSE,
diff --git a/test/testdata/ham/0361.36332081025aaf122520737c26461a88.eml b/test/testdata/ham/0361.36332081025aaf122520737c26461a88.eml
index f0155b2e660a..b3042a2489b7 100644
--- a/test/testdata/ham/0361.36332081025aaf122520737c26461a88.eml
+++ b/test/testdata/ham/0361.36332081025aaf122520737c26461a88.eml
@@ -47,7 +47,7 @@ List-Id: Friends of Rohit Khare <fork.xent.com>
 List-Unsubscribe: <http://xent.com/mailman/listinfo/fork>,
     <mailto:fork-request@xent.com?subject=unsubscribe>
 List-Archive: <http://xent.com/pipermail/fork/>
-Date: Mon, 26 Aug 2002 14:13:15 UT
+Date: Mon, 26 Aug 2002 14:13:15 UTC
 X-Pyzor: Reported 0 times.
 X-Spam-Status: No, hits=-5.7 required=7.0
 	tests=KNOWN_MAILING_LIST,QUOTED_EMAIL_TEXT,SIGNATURE_SHORT_DENSE,
diff --git a/utils_test.go b/utils_test.go
index 27fdb96564c1..16104eafe354 100644
--- a/utils_test.go
+++ b/utils_test.go
@@ -38,7 +38,7 @@ func ExampleSort() {
 
 	fmt.Printf("First node subject: %s\n", x.Subject())
 
-	// Output: First node subject: 1970-01-01 00:00:00 +0000 UTC : Re: My source: RE: A biblical digression :: node synthesized by https://gatherstars.com/
+	// Output: First node subject: 2002-02-01 05:44:14 +0000 UTC : Please help a newbie compile mplayer :-)
 }
 
 func ExampleWalk_depth() {
-- 
2.37.2

