[PATCH 13/18] test: add tests for insert
authorPeter Wang <novalazy@gmail.com>
Wed, 25 Jul 2012 13:42:42 +0000 (23:42 +1000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:36 +0000 (09:48 -0800)
92/06f2a414accf8601f5c7e5e05927d636dc7529 [new file with mode: 0644]

diff --git a/92/06f2a414accf8601f5c7e5e05927d636dc7529 b/92/06f2a414accf8601f5c7e5e05927d636dc7529
new file mode 100644 (file)
index 0000000..c9e06d5
--- /dev/null
@@ -0,0 +1,143 @@
+Return-Path: <novalazy@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id C291D431FAE\r
+       for <notmuch@notmuchmail.org>; Wed, 25 Jul 2012 06:44:41 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id NvrW0JT7jPaE for <notmuch@notmuchmail.org>;\r
+       Wed, 25 Jul 2012 06:44:39 -0700 (PDT)\r
+Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com\r
+       [209.85.160.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 06FE9431FB6\r
+       for <notmuch@notmuchmail.org>; Wed, 25 Jul 2012 06:44:29 -0700 (PDT)\r
+Received: by mail-pb0-f53.google.com with SMTP id rr13so1767731pbb.26\r
+       for <notmuch@notmuchmail.org>; Wed, 25 Jul 2012 06:44:29 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=+SrQU1UNIJx5FBpebPtO/T3XksimAasvMcBpunplQjY=;\r
+       b=tpJPYREEMERXhsy5BRgsqkCESL5BQYT/JAAKUvY+ms2iO90WVoGqT3l3uCkpom5vMn\r
+       +/xvWK7wwkH2ZPqlABGaI/+9UEe9+h0p5XLTAnih1yG6JD85ojLeds6xt838VHJM3GwG\r
+       97PNS7CbEcQ3DBF0KNinn2LvdLe0l1Boq0O72EvEpkklDIvT0ypBP7WQMri1/6eDMp29\r
+       GjQHk1RPbLJK/xSMEMCcEuv5Zp5rp2n0bP9G4GBKNYu6aYcsUrO7Q2gZbzI0IUfegeZ3\r
+       Ed0yhvazhVvxT8uNGzh2aPbQ72Edy6Qb38PqnbWak0ijluhhnjqkFzB0V2qVE/0eTuYg\r
+       p5hw==\r
+Received: by 10.68.224.233 with SMTP id rf9mr54371919pbc.141.1343223869417;\r
+       Wed, 25 Jul 2012 06:44:29 -0700 (PDT)\r
+Received: from localhost (215.42.233.220.static.exetel.com.au.\r
+       [220.233.42.215])\r
+       by mx.google.com with ESMTPS id gf3sm6124497pbc.74.2012.07.25.06.44.26\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 25 Jul 2012 06:44:28 -0700 (PDT)\r
+From: Peter Wang <novalazy@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 13/18] test: add tests for insert\r
+Date: Wed, 25 Jul 2012 23:42:42 +1000\r
+Message-Id: <1343223767-9812-13-git-send-email-novalazy@gmail.com>\r
+X-Mailer: git-send-email 1.7.4.4\r
+In-Reply-To: <1343223767-9812-1-git-send-email-novalazy@gmail.com>\r
+References: <1343223767-9812-1-git-send-email-novalazy@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 25 Jul 2012 13:44:42 -0000\r
+\r
+Add tests for new 'insert' command.\r
+---\r
+ test/insert       |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+ test/notmuch-test |    1 +\r
+ 2 files changed, 54 insertions(+), 0 deletions(-)\r
+ create mode 100755 test/insert\r
+\r
+diff --git a/test/insert b/test/insert\r
+new file mode 100755\r
+index 0000000..3514920\r
+--- /dev/null\r
++++ b/test/insert\r
+@@ -0,0 +1,53 @@\r
++#!/usr/bin/env bash\r
++test_description='"notmuch insert"'\r
++. ./test-lib.sh\r
++\r
++# Create directories and database before inserting.\r
++mkdir -p "$MAIL_DIR"/{cur,new,tmp}\r
++mkdir -p "$MAIL_DIR"/Drafts/{cur,new,tmp}\r
++notmuch new > /dev/null\r
++\r
++# We use generate_message to create the temporary message file.\r
++# It happens to be in the mail directory already but that is okay.\r
++\r
++test_begin_subtest "Insert message, default"\r
++generate_message \\r
++    "[subject]=\"insert-subject\"" \\r
++    "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \\r
++    "[body]=\"insert-message\""\r
++notmuch insert < "$gen_msg_filename"\r
++test_expect_equal "`notmuch count subject:insert-subject tag:unread`" "1"\r
++\r
++test_begin_subtest "Insert message, add tag"\r
++generate_message \\r
++    "[subject]=\"insert-subject-addtag\"" \\r
++    "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \\r
++    "[body]=\"insert-message-addtag\""\r
++notmuch insert +custom < "$gen_msg_filename"\r
++test_expect_equal "`notmuch count tag:custom`" "1"\r
++\r
++test_begin_subtest "Insert message, add/remove tag"\r
++generate_message \\r
++    "[subject]=\"insert-subject-addrmtag\"" \\r
++    "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \\r
++    "[body]=\"insert-message-addrmtag\""\r
++notmuch insert -- +custom -unread < "$gen_msg_filename"\r
++test_expect_equal "`notmuch count tag:custom NOT tag:unread`" "1"\r
++\r
++test_begin_subtest "Insert message, folder"\r
++generate_message \\r
++    "[subject]=\"insert-subject-draft\"" \\r
++    "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \\r
++    "[body]=\"insert-message-draft\""\r
++notmuch insert --folder=Drafts < "$gen_msg_filename"\r
++test_expect_equal "`notmuch count folder:Drafts`" "1"\r
++\r
++test_begin_subtest "Insert message, folder and tags"\r
++generate_message \\r
++    "[subject]=\"insert-subject-draft\"" \\r
++    "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \\r
++    "[body]=\"insert-message-draft\""\r
++notmuch insert --folder=Drafts -- +draft -unread < "$gen_msg_filename"\r
++test_expect_equal "`notmuch count folder:Drafts tag:draft NOT tag:unread`" "1"\r
++\r
++test_done\r
+diff --git a/test/notmuch-test b/test/notmuch-test\r
+index ea39dfc..b40ba0b 100755\r
+--- a/test/notmuch-test\r
++++ b/test/notmuch-test\r
+@@ -22,6 +22,7 @@ TESTS="\r
+   config\r
+   new\r
+   count\r
++  insert\r
+   search\r
+   search-output\r
+   search-by-folder\r
+-- \r
+1.7.4.4\r
+\r