--- /dev/null
+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 A7A4E431FD6\r
+ for <notmuch@notmuchmail.org>; Fri, 21 Jun 2013 22:48:16 -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 ckxeG0QUWFQA for <notmuch@notmuchmail.org>;\r
+ Fri, 21 Jun 2013 22:48:11 -0700 (PDT)\r
+Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com\r
+ [209.85.220.42]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 6E0E8431FB6\r
+ for <notmuch@notmuchmail.org>; Fri, 21 Jun 2013 22:47:41 -0700 (PDT)\r
+Received: by mail-pa0-f42.google.com with SMTP id rl6so8790831pac.15\r
+ for <notmuch@notmuchmail.org>; Fri, 21 Jun 2013 22:47:40 -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=D7pXpe8OHnu2jofJFo6k5Qevrt9ddgvDcTwceFiZkUE=;\r
+ b=suVcvDZrfbSDzZwfiKw6MbKXd3hBnl1bykI2erL03+9LYsu7oJvDTFEb288yztZu/s\r
+ d4btpT6Rzlffp3kLCmEmPz612I2dn+Ykbc84scTWRAngZGyrv9fw11ZEnt/6RVLFfkT7\r
+ abzIa6i8hvup2x37Bsk13MCdh7I7HV9vwS+KpGbX/XQeptC2ZORzGI7bXRqzJT9AUC3+\r
+ TxYKWUnz1QMPtbNinZqAS2oIRvhrq444yujCMS0PN/Y3twQJfWS5+PEyDMy51u/bzkt1\r
+ fEEt46XyaGcwmk6i/Jda+rPlI2LDQH2pKubvaF1vUDoeoeSPL/Ei8eBNBRJFpMQuM9xu\r
+ iHuw==\r
+X-Received: by 10.66.179.78 with SMTP id de14mr19398929pac.18.1371880060722;\r
+ Fri, 21 Jun 2013 22:47:40 -0700 (PDT)\r
+Received: from localhost (215.42.233.220.static.exetel.com.au.\r
+ [220.233.42.215]) by mx.google.com with ESMTPSA id\r
+ re16sm8900263pac.16.2013.06.21.22.47.38 for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Fri, 21 Jun 2013 22:47:40 -0700 (PDT)\r
+From: Peter Wang <novalazy@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v6 09/12] test: test insert --folder option\r
+Date: Sat, 22 Jun 2013 15:46:45 +1000\r
+Message-Id: <1371880008-18312-10-git-send-email-novalazy@gmail.com>\r
+X-Mailer: git-send-email 1.7.12.1\r
+In-Reply-To: <1371880008-18312-1-git-send-email-novalazy@gmail.com>\r
+References: <1371880008-18312-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: Sat, 22 Jun 2013 05:48:16 -0000\r
+\r
+Add tests for notmuch insert --folder option.\r
+---\r
+ test/insert | 17 +++++++++++++++++\r
+ 1 file changed, 17 insertions(+)\r
+\r
+diff --git a/test/insert b/test/insert\r
+index b432a74..f573c76 100755\r
+--- a/test/insert\r
++++ b/test/insert\r
+@@ -77,4 +77,21 @@ notmuch insert +custom -unread < "$gen_msg_filename"\r
+ output=$(notmuch count tag:custom NOT tag:unread)\r
+ test_expect_equal "$output" "1"\r
+ \r
++test_begin_subtest "Insert message into folder"\r
++gen_insert_msg\r
++notmuch insert --folder=Drafts < "$gen_msg_filename"\r
++output=$(notmuch search --output=files folder:Drafts)\r
++dirname=$(dirname "$output")\r
++test_expect_equal "$dirname" "$MAIL_DIR/Drafts/cur"\r
++\r
++test_begin_subtest "Insert message into folder, add/remove tags"\r
++gen_insert_msg\r
++notmuch insert --folder=Drafts +draft -unread < "$gen_msg_filename"\r
++output=$(notmuch count folder:Drafts tag:draft NOT tag:unread)\r
++test_expect_equal "$output" "1"\r
++\r
++gen_insert_msg\r
++test_expect_code 1 "Insert message into non-existent folder" \\r
++ "notmuch insert --folder=nonesuch < $gen_msg_filename"\r
++\r
+ test_done\r
+-- \r
+1.7.12.1\r
+\r