--- /dev/null
+Return-Path: <jani@nikula.org>\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 E6240431FCF\r
+ for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 08:55:43 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[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 dJxGCtUqX7mS for <notmuch@notmuchmail.org>;\r
+ Sun, 23 Feb 2014 08:55:39 -0800 (PST)\r
+Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com\r
+ [74.125.83.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 073D1431FD9 for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 08:55:35 -0800\r
+ (PST)\r
+Received: by mail-ee0-f51.google.com with SMTP id b57so2652078eek.38\r
+ for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 08:55:34 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=g+FAkvWFq54bKweEwOXMY2ARDacnPy7bbFwYdZLAjWU=;\r
+ b=QHCrFW4gCKbAO9QeCHpvsSQpqmSCb9H9YWmvbRZI1PYDlnn93f5F3CgqBD7XCjrLiK\r
+ Jsp/JNV5PqXjib0QO2qzE37aufH9CMwbkC19IBVS1RuDhP4zuWoFZ8rVxQ534T1GCQD3\r
+ OmQHoln4+ma8VtWR9ezallGutsmx9JQDyH0z1J98q7G4lFwe4NtaXWSGDlyd0zRCdLnM\r
+ oxWwNHa71Xq5sTCfxjgAvyWqRikg8Xojxga6fl3BGAyOF6IJbLUiNytoU7JpXelIBbzW\r
+ c/RDOB20oGTR3nGLrmajI2CopiaopD4jYAGm7e0EfzEPREIHSRDFa1Ka1NErabbGLEQF\r
+ /dcw==\r
+X-Gm-Message-State:\r
+ ALoCoQmoCsyVD2+zg+JjzjyiR3ewVp8bHFJKRz8mhPhhPBlerhTS0F3JWbaXO2uHlE7nLEYeFude\r
+X-Received: by 10.15.42.72 with SMTP id t48mr19825625eev.45.1393174534751;\r
+ Sun, 23 Feb 2014 08:55:34 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+ [88.195.111.91])\r
+ by mx.google.com with ESMTPSA id 46sm53043064ees.4.2014.02.23.08.55.33\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sun, 23 Feb 2014 08:55:34 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org,\r
+ Rob Browning <rlb@defaultvalue.org>\r
+Subject: [PATCH 3/3] test: add tests for invalid new.tags\r
+Date: Sun, 23 Feb 2014 18:55:23 +0200\r
+Message-Id:\r
+ <ca31c06691e8b922bac90560733aef735525a1ed.1393174108.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.8.5.3\r
+In-Reply-To: <cover.1393174108.git.jani@nikula.org>\r
+References: <87ha7qfto7.fsf@trouble.defaultvalue.org>\r
+ <cover.1393174108.git.jani@nikula.org>\r
+In-Reply-To: <cover.1393174108.git.jani@nikula.org>\r
+References: <cover.1393174108.git.jani@nikula.org>\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: Sun, 23 Feb 2014 16:55:44 -0000\r
+\r
+Similar tests for both notmuch new and insert.\r
+---\r
+ test/T050-new.sh | 17 +++++++++++++++++\r
+ test/T070-insert.sh | 19 +++++++++++++++++++\r
+ 2 files changed, 36 insertions(+)\r
+\r
+diff --git a/test/T050-new.sh b/test/T050-new.sh\r
+index b7668ff0c4bc..ad46ee6d51b6 100755\r
+--- a/test/T050-new.sh\r
++++ b/test/T050-new.sh\r
+@@ -263,4 +263,21 @@ notmuch search --format=text0 --output=files --offset=1 --limit=1 '*' | xargs -0\r
+ output=$(NOTMUCH_NEW --quiet)\r
+ test_expect_equal "$output" ""\r
+ \r
++OLDCONFIG=$(notmuch config get new.tags)\r
++\r
++test_begin_subtest "Empty tags in new.tags are forbidden"\r
++notmuch config set new.tags "foo;;bar"\r
++output=$(NOTMUCH_NEW 2>&1)\r
++test_expect_equal "$output" "Error: tag '' in new.tags: empty tag forbidden"\r
++\r
++test_begin_subtest "Tags starting with '-' in new.tags are forbidden"\r
++notmuch config set new.tags "-foo;bar"\r
++output=$(NOTMUCH_NEW 2>&1)\r
++test_expect_equal "$output" "Error: tag '-foo' in new.tags: tag starting with '-' forbidden"\r
++\r
++test_expect_code 1 "Invalid tags set exit code" \\r
++ "NOTMUCH_NEW 2>&1"\r
++\r
++notmuch config set new.tags $OLDCONFIG\r
++\r
+ test_done\r
+diff --git a/test/T070-insert.sh b/test/T070-insert.sh\r
+index e8dc4c099ed1..b77c5e13c87f 100755\r
+--- a/test/T070-insert.sh\r
++++ b/test/T070-insert.sh\r
+@@ -164,4 +164,23 @@ 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
++OLDCONFIG=$(notmuch config get new.tags)\r
++\r
++test_begin_subtest "Empty tags in new.tags are forbidden"\r
++notmuch config set new.tags "foo;;bar"\r
++gen_insert_msg\r
++output=$(notmuch insert $gen_msg_filename 2>&1)\r
++test_expect_equal "$output" "Error: tag '' in new.tags: empty tag forbidden"\r
++\r
++test_begin_subtest "Tags starting with '-' in new.tags are forbidden"\r
++notmuch config set new.tags "-foo;bar"\r
++gen_insert_msg\r
++output=$(notmuch insert $gen_msg_filename 2>&1)\r
++test_expect_equal "$output" "Error: tag '-foo' in new.tags: tag starting with '-' forbidden"\r
++\r
++test_expect_code 1 "Invalid tags set exit code" \\r
++ "notmuch insert $gen_msg_filename 2>&1"\r
++\r
++notmuch config set new.tags $OLDCONFIG\r
++\r
+ test_done\r
+-- \r
+1.8.5.3\r
+\r