[PATCH 4/4] parser: Validate deep threading behavior

Stephen Finucane stephen at that.guru
Wed May 24 16:02:24 AEST 2017


This is pretty simple but let's add this to prevent regressions.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/tests/series/base-deep-threaded.mbox | 127 +++++++++++++++++++++++++
 patchwork/tests/test_series.py                 |  18 ++++
 2 files changed, 145 insertions(+)
 create mode 100644 patchwork/tests/series/base-deep-threaded.mbox

diff --git a/patchwork/tests/series/base-deep-threaded.mbox b/patchwork/tests/series/base-deep-threaded.mbox
new file mode 100644
index 0000000..486dc0d
--- /dev/null
+++ b/patchwork/tests/series/base-deep-threaded.mbox
@@ -0,0 +1,127 @@
+From stephenfinucane at gmail.com Sun Sep 11 23:22:13 2016
+Return-Path: <stephenfinucane at gmail.com>
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH 0/2] A sample series
+Date: Sun, 11 Sep 2016 23:22:02 +0100
+Message-ID: <1473632524-8585-1-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 395
+Lines: 18
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+This is a sample cover letter. It doesn't really contribute to the
+conversation, but I added it anway.
+
+Stephen Finucane (2):
+  test: Add some lorem ipsum
+  test: Convert to Markdown
+
+ test.md  | 8 ++++++++
+ test.txt | 1 -
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+ create mode 100644 test.md
+ delete mode 100644 test.txt
+
+-- 
+2.7.4
+
+
+From stephenfinucane at gmail.com Sun Sep 11 23:22:13 2016
+Return-Path: <stephenfinucane at gmail.com>
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH 1/2] test: Add some lorem ipsum
+Date: Sun, 11 Sep 2016 23:22:03 +0100
+Message-ID: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+In-Reply-To: <1473632524-8585-1-git-send-email-stephenfinucane at gmail.com>
+References: <1473632524-8585-1-git-send-email-stephenfinucane at gmail.com>
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 670
+Lines: 22
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+---
+ test.txt | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/test.txt b/test.txt
+index f75ba05..a6c61c0 100644
+--- a/test.txt
++++ b/test.txt
+@@ -1 +1,8 @@
+ Hello, world.
++
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
++augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
++Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
++id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
++eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
++tellus commodo bibendum ut vel dolor.
+-- 
+2.7.4
+
+
+From stephenfinucane at gmail.com Sun Sep 11 23:22:16 2016
+Return-Path: <stephenfinucane at gmail.com>
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH 2/2] test: Convert to Markdown
+Date: Sun, 11 Sep 2016 23:22:04 +0100
+Message-ID: <1473632524-8585-3-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+In-Reply-To: <1473632524-8585-1-git-send-email-stephenfinucane at gmail.com>
+References: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+	<1473632524-8585-1-git-send-email-stephenfinucane at gmail.com>
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 1345
+Lines: 40
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+---
+ test.md  | 8 ++++++++
+ test.txt | 8 --------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+ create mode 100644 test.md
+ delete mode 100644 test.txt
+
+diff --git a/test.md b/test.md
+new file mode 100644
+index 0000000..e5ff90e
+--- /dev/null
++++ b/test.md
+@@ -0,0 +1,8 @@
++# Hello, world
++
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
++augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
++Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
++id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
++eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
++tellus commodo bibendum ut vel dolor.
+diff --git a/test.txt b/test.txt
+deleted file mode 100644
+index a6c61c0..0000000
+--- a/test.txt
++++ /dev/null
+@@ -1,8 +0,0 @@
+-Hello, world.
+-
+-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
+-augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
+-Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
+-id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
+-eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
+-tellus commodo bibendum ut vel dolor.
+-- 
+2.7.4
+
+
diff --git a/patchwork/tests/test_series.py b/patchwork/tests/test_series.py
index 06288de..181fc6d 100644
--- a/patchwork/tests/test_series.py
+++ b/patchwork/tests/test_series.py
@@ -126,6 +126,24 @@ class BaseSeriesTest(_BaseTestCase):
 
         self.assertSerialized(patches, [2])
 
+    def test_deep_threaded(self):
+        """Series with deep threading.
+
+        Parse a series with a cover letter and two patches that uses
+        deep threading (git-format-patch --thread=deep).
+
+        Input:
+
+          - [PATCH 0/2] A sample series
+            - [PATCH 1/2] test: Add some lorem ipsum
+              - [PATCH 2/2] test: Convert to Markdown
+        """
+        covers, patches, _ = self._parse_mbox(
+            'base-deep-threaded.mbox', [1, 2, 0])
+
+        self.assertSerialized(patches, [2])
+        self.assertSerialized(covers, [1])
+
     def test_out_of_order(self):
         """Series received out of order.
 
-- 
2.9.4



More information about the Patchwork mailing list