git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGIT PATCH 1/2] Regression test for "stg import"
Date: Sun, 12 Nov 2006 22:15:51 +0100	[thread overview]
Message-ID: <20061112211551.19362.91978.stgit@localhost> (raw)
In-Reply-To: <20061112211434.19362.66077.stgit@localhost>

From: Karl Hasselström <kha@treskal.com>



Signed-off-by: Karl Hasselström <kha@treskal.com>
---

 t/t1800-import.sh         |   85 ++++++++++++++++++++++++++++++++++++++
 t/t1800-import/email-8bit |   37 ++++++++++++++++
 t/t1800-import/email-mbox |  102 +++++++++++++++++++++++++++++++++++++++++++++
 t/t1800-import/email-qp   |   37 ++++++++++++++++
 t/t1800-import/git-diff   |   20 +++++++++
 t/t1800-import/gnu-diff   |   19 ++++++++
 t/t1800-import/stg-export |   26 +++++++++++
 7 files changed, 326 insertions(+), 0 deletions(-)

diff --git a/t/t1800-import.sh b/t/t1800-import.sh
new file mode 100755
index 0000000..0c1baa3
--- /dev/null
+++ b/t/t1800-import.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+# Copyright (c) 2006 Karl Hasselström
+test_description='Test the import command'
+. ./test-lib.sh
+
+test_expect_success \
+    'Initialize the StGIT repository' \
+    '
+    for x in {do,di,da}{be,bi,bo}{dam,dim,dum}; do
+      echo $x
+    done > foo.txt &&
+    git add foo.txt &&
+    git commit -a -m "initial version" &&
+    stg init
+    '
+
+test_expect_success \
+    'Apply a patch created with "git diff"' \
+    '
+    stg import ../t1800-import/git-diff &&
+    [ $(git cat-file -p $(stg id) \
+        | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") == 1 ] &&
+    stg delete ..
+    '
+
+test_expect_success \
+    'Apply a patch created with GNU diff' \
+    '
+    stg import ../t1800-import/gnu-diff &&
+    [ $(git cat-file -p $(stg id) \
+        | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") == 1 ] &&
+    stg delete ..
+    '
+
+test_expect_success \
+    'Apply a patch created with "stg export"' \
+    '
+    stg import ../t1800-import/stg-export &&
+    [ $(git cat-file -p $(stg id) \
+        | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") == 1 ] &&
+    stg delete ..
+    '
+
+test_expect_success \
+    'Apply a patch from an 8bit-encoded e-mail' \
+    '
+    stg import -m ../t1800-import/email-8bit &&
+    [ $(git cat-file -p $(stg id) \
+        | grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") == 1 ] &&
+    [ $(git cat-file -p $(stg id) \
+        | grep -c "author Inge Ström <inge@power.com>") == 1 ] &&
+    stg delete ..
+    '
+
+test_expect_success \
+    'Apply a patch from a QP-encoded e-mail' \
+    '
+    stg import -m ../t1800-import/email-qp &&
+    [ $(git cat-file -p $(stg id) \
+        | grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") == 1 ] &&
+    [ $(git cat-file -p $(stg id) \
+        | grep -c "author Inge Ström <inge@power.com>") == 1 ] &&
+    stg delete ..
+    '
+
+test_expect_success \
+    'Apply several patches from an mbox file' \
+    '
+    stg import -M ../t1800-import/email-mbox &&
+    [ $(git cat-file -p $(stg id change-1) \
+        | grep -c "tree 401bef82cd9fb403aba18f480a63844416a2e023") == 1 ] &&
+    [ $(git cat-file -p $(stg id change-1) \
+        | grep -c "author Inge Ström <inge@power.com>") == 1 ] &&
+    [ $(git cat-file -p $(stg id change-2) \
+        | grep -c "tree e49dbce010ec7f441015a8c64bce0b99108af4cc") == 1 ] &&
+    [ $(git cat-file -p $(stg id change-2) \
+        | grep -c "author Inge Ström <inge@power.com>") == 1 ] &&
+    [ $(git cat-file -p $(stg id change-3) \
+        | grep -c "tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5") == 1 ] &&
+    [ $(git cat-file -p $(stg id change-3) \
+        | grep -c "author Inge Ström <inge@power.com>") == 1 ] &&
+    stg delete ..
+    '
+
+test_done
diff --git a/t/t1800-import/email-8bit b/t/t1800-import/email-8bit
new file mode 100644
index 0000000..316fe27
--- /dev/null
+++ b/t/t1800-import/email-8bit
@@ -0,0 +1,37 @@
+From: Inge =?utf-8?q?Str=C3=B6m?= <inge@power.com>
+Subject: [PATCH] test patch
+To: Upstream <foo@bar.baz>
+Date: Sat, 11 Nov 2006 11:58:14 +0100
+Message-ID: <20061111105814.23209.46952.stgit@localhost>
+User-Agent: StGIT/0.11
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Inge Ström <inge@power.com>
+---
+
+ foo.txt |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/foo.txt b/foo.txt
+index ad01662..d3cd5b6 100644
+--- a/foo.txt
++++ b/foo.txt
+@@ -3,6 +3,7 @@ dobedim
+ dobedum
+ dobidam
+ dobidim
++pum-pöddelipåm
+ dobidum
+ dobodam
+ dobodim
+@@ -20,6 +21,7 @@ dabedam
+ dabedim
+ dabedum
+ dabidam
++pum-däddelidum
+ dabidim
+ dabidum
+ dabodam
+
diff --git a/t/t1800-import/email-mbox b/t/t1800-import/email-mbox
new file mode 100644
index 0000000..e4103e5
--- /dev/null
+++ b/t/t1800-import/email-mbox
@@ -0,0 +1,102 @@
+From nobody Sat Nov 11 12:45:27 2006
+From: Inge =?utf-8?q?Str=C3=B6m?= <inge@power.com>
+Subject: [PATCH 1/3] Change 1
+To: Upstream <foo@bar.baz>
+Date: Sat, 11 Nov 2006 12:45:27 +0100
+Message-ID: <20061111114527.31778.12942.stgit@localhost>
+User-Agent: StGIT/0.11
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+Status: RO
+Content-Length: 304
+Lines: 19
+
+Signed-off-by: Inge Ström <inge@power.com>
+---
+
+ foo.txt |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/foo.txt b/foo.txt
+index ad01662..91527b1 100644
+--- a/foo.txt
++++ b/foo.txt
+@@ -7,7 +7,7 @@ dobidum
+ dobodam
+ dobodim
+ dobodum
+-dibedam
++dibedad
+ dibedim
+ dibedum
+ dibidam
+
+From nobody Sat Nov 11 12:45:27 2006
+From: Inge =?utf-8?q?Str=C3=B6m?= <inge@power.com>
+Subject: [PATCH 2/3] Change 2
+To: Upstream <foo@bar.baz>
+Date: Sat, 11 Nov 2006 12:45:27 +0100
+Message-ID: <20061111114527.31778.92851.stgit@localhost>
+In-Reply-To: <20061111114527.31778.12942.stgit@localhost>
+References: <20061111114527.31778.12942.stgit@localhost>
+User-Agent: StGIT/0.11
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+Status: RO
+Content-Length: 296
+Lines: 18
+
+Signed-off-by: Inge Ström <inge@power.com>
+---
+
+ foo.txt |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/foo.txt b/foo.txt
+index 91527b1..79922d7 100644
+--- a/foo.txt
++++ b/foo.txt
+@@ -18,6 +18,7 @@ dibodim
+ dibodum
+ dabedam
+ dabedim
++dibedam
+ dabedum
+ dabidam
+ dabidim
+
+From nobody Sat Nov 11 12:45:27 2006
+From: Inge =?utf-8?q?Str=C3=B6m?= <inge@power.com>
+Subject: [PATCH 3/3] Change 3
+To: Upstream <foo@bar.baz>
+Date: Sat, 11 Nov 2006 12:45:27 +0100
+Message-ID: <20061111114527.31778.45876.stgit@localhost>
+In-Reply-To: <20061111114527.31778.12942.stgit@localhost>
+References: <20061111114527.31778.12942.stgit@localhost>
+User-Agent: StGIT/0.11
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+Status: RO
+Content-Length: 278
+Lines: 16
+
+Signed-off-by: Inge Ström <inge@power.com>
+---
+
+ foo.txt |    1 -
+ 1 files changed, 0 insertions(+), 1 deletions(-)
+
+diff --git a/foo.txt b/foo.txt
+index 79922d7..6f978b4 100644
+--- a/foo.txt
++++ b/foo.txt
+@@ -24,5 +24,4 @@ dabidam
+ dabidim
+ dabidum
+ dabodam
+-dabodim
+ dabodum
+
diff --git a/t/t1800-import/email-qp b/t/t1800-import/email-qp
new file mode 100644
index 0000000..1a77c57
--- /dev/null
+++ b/t/t1800-import/email-qp
@@ -0,0 +1,37 @@
+From: Inge =?utf-8?q?Str=C3=B6m?= <inge@power.com>
+Subject: [PATCH] test patch
+To: Upstream <foo@bar.baz>
+Date: Sat, 11 Nov 2006 11:58:14 +0100
+Message-ID: <20061111105814.23209.46952.stgit@localhost>
+User-Agent: StGIT/0.11
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: quoted-printable
+
+Signed-off-by: Inge Str=C3=B6m <inge@power.com>
+---
+
+ foo.txt |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/foo.txt b/foo.txt
+index ad01662..d3cd5b6 100644
+--- a/foo.txt
++++ b/foo.txt
+@@ -3,6 +3,7 @@ dobedim
+ dobedum
+ dobidam
+ dobidim
++pum-p=C3=B6ddelip=C3=A5m
+ dobidum
+ dobodam
+ dobodim
+@@ -20,6 +21,7 @@ dabedam
+ dabedim
+ dabedum
+ dabidam
++pum-d=C3=A4ddelidum
+ dabidim
+ dabidum
+ dabodam
+
diff --git a/t/t1800-import/git-diff b/t/t1800-import/git-diff
new file mode 100644
index 0000000..642e11d
--- /dev/null
+++ b/t/t1800-import/git-diff
@@ -0,0 +1,20 @@
+diff --git a/foo.txt b/foo.txt
+index ad01662..d3cd5b6 100644
+--- a/foo.txt
++++ b/foo.txt
+@@ -3,6 +3,7 @@ dobedim
+ dobedum
+ dobidam
+ dobidim
++dabadadash
+ dobidum
+ dobodam
+ dobodim
+@@ -20,6 +21,7 @@ dabedam
+ dabedim
+ dabedum
+ dabidam
++dadadadash
+ dabidim
+ dabidum
+ dabodam
diff --git a/t/t1800-import/gnu-diff b/t/t1800-import/gnu-diff
new file mode 100644
index 0000000..46b338a
--- /dev/null
+++ b/t/t1800-import/gnu-diff
@@ -0,0 +1,19 @@
+diff -Naur old/foo.txt new/foo.txt
+--- old/foo.txt	2006-11-11 11:26:18.000000000 +0100
++++ new/foo.txt	2006-11-11 11:25:18.000000000 +0100
+@@ -3,6 +3,7 @@
+ dobedum
+ dobidam
+ dobidim
++dabadadash
+ dobidum
+ dobodam
+ dobodim
+@@ -20,6 +21,7 @@
+ dabedim
+ dabedum
+ dabidam
++dadadadash
+ dabidim
+ dabidum
+ dabodam
diff --git a/t/t1800-import/stg-export b/t/t1800-import/stg-export
new file mode 100644
index 0000000..ddcfc3e
--- /dev/null
+++ b/t/t1800-import/stg-export
@@ -0,0 +1,26 @@
+test patch
+---
+
+ foo.txt |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/foo.txt b/foo.txt
+index ad01662..d3cd5b6 100644
+--- a/foo.txt
++++ b/foo.txt
+@@ -3,6 +3,7 @@ dobedim
+ dobedum
+ dobidam
+ dobidim
++dabadadash
+ dobidum
+ dobodam
+ dobodim
+@@ -20,6 +21,7 @@ dabedam
+ dabedim
+ dabedum
+ dabidam
++dadadadash
+ dabidim
+ dabidum

  reply	other threads:[~2006-11-12 21:16 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-01  9:00 [PATCH] Allow hand-editing of patches before sending Karl Hasselström
2006-11-02 10:32 ` Catalin Marinas
2006-11-02 11:36   ` Karl Hasselström
2006-11-03  9:39     ` Catalin Marinas
2006-11-03  9:58       ` Karl Hasselström
2006-11-03 10:01         ` Karl Hasselström
2006-11-03 10:21           ` Petr Baudis
2006-11-03 10:31             ` Robin Rosenberg
2006-11-03 10:36             ` Andreas Ericsson
2006-11-03 10:53               ` Karl Hasselström
2006-11-03 11:21                 ` Junio C Hamano
2006-11-03 11:35                   ` Karl Hasselström
2006-11-03 12:56                   ` Catalin Marinas
2006-11-03 12:07           ` Andy Whitcroft
2006-11-03 12:36             ` Karl Hasselström
2006-11-03 14:03             ` Andy Whitcroft
2006-11-03 18:48               ` Linus Torvalds
2006-11-05 11:43                 ` Karl Hasselström
2006-11-05 16:44                   ` Linus Torvalds
2006-11-05 19:04                     ` Karl Hasselström
2006-11-05 19:29                       ` Jakub Narebski
2006-11-06  7:45                         ` [PATCH] Add a MIME-Version header to e-mails Karl Hasselström
2006-11-06  7:56                           ` Karl Hasselström
2006-11-07  9:53                           ` Catalin Marinas
2006-11-07 19:09                             ` Catalin Marinas
2006-11-08  8:40                               ` Karl Hasselström
2006-11-08  9:41                                 ` Catalin Marinas
2006-11-08 10:01                                   ` Karl Hasselström
2006-11-08 10:12                                     ` Catalin Marinas
2006-11-12 21:14                                       ` [StGIT PATCH 0/2] mail and import tests Karl Hasselström
2006-11-12 21:15                                         ` Karl Hasselström [this message]
2006-11-12 21:15                                         ` [StGIT PATCH 2/2] Regression test for "stg mail" Karl Hasselström
2006-11-11 12:24                               ` [PATCH] Add a MIME-Version header to e-mails Karl Hasselström
2006-11-16 17:24                                 ` Catalin Marinas
2006-11-03 12:44         ` [PATCH] Allow hand-editing of patches before sending Catalin Marinas
2006-11-03 13:02           ` Karl Hasselström
2006-11-03 13:16             ` Catalin Marinas
2006-11-03 13:25               ` Karl Hasselström
2006-11-03 13:25             ` Catalin Marinas
2006-11-03 13:33               ` Karl Hasselström
2006-11-03 13:42                 ` Karl Hasselström
2006-11-03 13:56                 ` Catalin Marinas
2006-11-03 14:37                   ` Catalin Marinas
2006-11-03 13:39               ` Petr Baudis
2006-11-03 14:01                 ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061112211551.19362.91978.stgit@localhost \
    --to=kha@treskal.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).