[PATCH v5 12/12] test: test insert --create-folder option
authorPeter Wang <novalazy@gmail.com>
Tue, 2 Apr 2013 22:41:57 +0000 (09:41 +1100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:54:13 +0000 (09:54 -0800)
ef/f7a2f5c05fee0dd360dac3590ba749b9935dee [new file with mode: 0644]

diff --git a/ef/f7a2f5c05fee0dd360dac3590ba749b9935dee b/ef/f7a2f5c05fee0dd360dac3590ba749b9935dee
new file mode 100644 (file)
index 0000000..cbd8ecd
--- /dev/null
@@ -0,0 +1,103 @@
+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 47C72431FAF\r
+       for <notmuch@notmuchmail.org>; Tue,  2 Apr 2013 15:43:29 -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 21S+r0YteapY for <notmuch@notmuchmail.org>;\r
+       Tue,  2 Apr 2013 15:43:27 -0700 (PDT)\r
+Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com\r
+       [209.85.220.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id EF56B431FBC\r
+       for <notmuch@notmuchmail.org>; Tue,  2 Apr 2013 15:43:19 -0700 (PDT)\r
+Received: by mail-pa0-f43.google.com with SMTP id hz11so548301pad.16\r
+       for <notmuch@notmuchmail.org>; Tue, 02 Apr 2013 15:43:19 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+       :references; bh=vn0tCk0YqrIc2URGHNKFhH7lltf38rbzXtMeSuIyHyI=;\r
+       b=ojqEsUHodMjsSsWG6gaPEBtHkmagIeH8VkkcdFb2ernQ1YYcgdTV9N7kgrPqLb+kK1\r
+       EUScP4tSxeVD6b94j097VbgH9Fqf4EOM4unylr0f++HmTNmbLzvaHEdSVS+Vx14wU7KD\r
+       vOxlZ35+DFC6mWa8+WWfTeADit5Upr9lNDIra9WincAG4w9wTeB3wA1qPpyTbEOWD4J5\r
+       ZFk8lI+0PHeKo1/7xVuDlZVL5GFW+aGyMDtDqSuzXRpd5qbVIrv5b34UURMBRw0ojDNK\r
+       vd5WuhOIP6NKJDKmjBflLZJZThQHUjBQKcY79IW688rPsSjbtSyPp2LBmfncwZnioUjm\r
+       Aj6A==\r
+X-Received: by 10.68.245.69 with SMTP id xm5mr26754278pbc.97.1364942599257;\r
+       Tue, 02 Apr 2013 15:43:19 -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 ql7sm3299777pbb.2.2013.04.02.15.43.16\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Tue, 02 Apr 2013 15:43:18 -0700 (PDT)\r
+From: Peter Wang <novalazy@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v5 12/12] test: test insert --create-folder option\r
+Date: Wed,  3 Apr 2013 09:41:57 +1100\r
+Message-Id: <1364942517-6982-13-git-send-email-novalazy@gmail.com>\r
+X-Mailer: git-send-email 1.7.12.1\r
+In-Reply-To: <1364942517-6982-1-git-send-email-novalazy@gmail.com>\r
+References: <1364942517-6982-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: Tue, 02 Apr 2013 22:43:29 -0000\r
+\r
+Add tests for notmuch insert --create-folder option.\r
+---\r
+ test/insert | 24 ++++++++++++++++++++++++\r
+ 1 file changed, 24 insertions(+)\r
+\r
+diff --git a/test/insert b/test/insert\r
+index 44e071c..24a61e1 100755\r
+--- a/test/insert\r
++++ b/test/insert\r
+@@ -83,4 +83,28 @@ gen_insert_msg\r
+ test_expect_code 1 "Insert message, non-existent folder" \\r
+     "notmuch insert --folder=nonesuch < $gen_msg_filename"\r
\r
++test_begin_subtest "Insert message, create folder"\r
++gen_insert_msg\r
++notmuch insert --folder=F --create-folder +folder < "$gen_msg_filename"\r
++output=$(notmuch search --output=files folder:F tag:folder)\r
++basename=$(basename "$output")\r
++test_expect_equal_file "$gen_msg_filename" "$MAIL_DIR/F/cur/${basename}"\r
++\r
++test_begin_subtest "Insert message, create subfolder"\r
++gen_insert_msg\r
++notmuch insert --folder=F/G/H/I/J --create-folder +folder < "$gen_msg_filename"\r
++output=$(notmuch search --output=files folder:F/G/H/I/J tag:folder)\r
++basename=$(basename "$output")\r
++test_expect_equal_file "$gen_msg_filename" "${MAIL_DIR}/F/G/H/I/J/cur/${basename}"\r
++\r
++test_begin_subtest "Insert message, create existing subfolder"\r
++gen_insert_msg\r
++notmuch insert --folder=F/G/H/I/J --create-folder +folder < "$gen_msg_filename"\r
++output=$(notmuch count folder:F/G/H/I/J tag:folder)\r
++test_expect_equal "$output" "2"\r
++\r
++gen_insert_msg\r
++test_expect_code 1 "Insert message, create invalid subfolder" \\r
++    "notmuch insert --folder=../G --create-folder $gen_msg_filename"\r
++\r
+ test_done\r
+-- \r
+1.7.12.1\r
+\r