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