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 A1FFD40496E for ; Thu, 18 Mar 2010 08:41:00 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.271 X-Spam-Level: X-Spam-Status: No, score=-2.271 tagged_above=-999 required=5 tests=[AWL=0.328, BAYES_00=-2.599] autolearn=ham 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 Ik2DhMgBf7oR for ; Thu, 18 Mar 2010 08:40:59 -0700 (PDT) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id B6AF8404966 for ; Thu, 18 Mar 2010 08:40:55 -0700 (PDT) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 2AAA819F33D7; Thu, 18 Mar 2010 16:40:55 +0100 (CET) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id rY-0vUw0GZgT; Thu, 18 Mar 2010 16:40:52 +0100 (CET) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id C99A819F340B; Thu, 18 Mar 2010 16:40:51 +0100 (CET) Received: from steelpick.localdomain (k335-30.felk.cvut.cz [147.32.86.30]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id B1D3AFA004; Thu, 18 Mar 2010 16:40:51 +0100 (CET) Received: from wsh by steelpick.localdomain with local (Exim 4.71) (envelope-from ) id 1NsHq7-0005Ho-F3; Thu, 18 Mar 2010 16:40:51 +0100 From: Michal Sojka To: notmuch@notmuchmail.org Date: Thu, 18 Mar 2010 16:39:40 +0100 Message-Id: <1268926780-20045-5-git-send-email-sojkam1@fel.cvut.cz> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1268926780-20045-1-git-send-email-sojkam1@fel.cvut.cz> References: <1268926780-20045-1-git-send-email-sojkam1@fel.cvut.cz> Subject: [notmuch] [PATCH 4/4] Tests for maildir-based mailstore 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: Thu, 18 Mar 2010 15:41:01 -0000 Signed-off-by: Michal Sojka --- test/t0006-maildir.sh | 113 +++++++++++++++++++++++++++++++++++++++++++++++++ test/test-lib.sh | 7 ++- 2 files changed, 118 insertions(+), 2 deletions(-) create mode 100755 test/t0006-maildir.sh diff --git a/test/t0006-maildir.sh b/test/t0006-maildir.sh new file mode 100755 index 0000000..e584908 --- /dev/null +++ b/test/t0006-maildir.sh @@ -0,0 +1,113 @@ +#!/bin/bash + +test_description="Test maildir mailstore" + +. ./test-lib.sh + +filter_output() { + grep -v -E -e "$NOTMUCH_IGNORED_OUTPUT_REGEXP" | sed -e "$NOTMUCH_THREAD_ID_SQUELCH" +} + +filter_show() { + sed -e 's/, /,\n/g'|sed -e '/^"filename"/ s/:2,[A-Z]*//' -e '/^"tags"/d' +} + +cat >> "$NOTMUCH_CONFIG" < expected < actual && +test_cmp expected actual +#emacs --eval "(gdb \"gdb --annotate=3 --args $(which notmuch) new\")" +' +cat > expected < actual && +test_cmp expected actual +' +cat > expected < actual && +test_cmp expected actual +' +cat > expected < actual && +test_cmp expected actual +' +cat > expected < actual && +test_cmp expected actual +' +cat > expected < actual && +test_cmp expected actual +' +test_expect_success 'Tag the seen messages as replied' ' +notmuch tag +replied -inbox tag:inbox and not tag:unread +' + +cat > expected < actual && +test_cmp expected actual +' +echo -n '[[[{"id": "msg-001@notmuch-test-suite", +"match": true, +"filename": "/home/wsh/src/notmuch/test/trash directory.t0006-maildir/mail/msg-001", +"headers": {"Subject": "test message", +"From": "Notmuch Test Suite ", +"To": "Notmuch Test Suite ", +"Cc": "", +"Bcc": "", +"Date": "Sat, +01 Jan 2000 12:00:00 -0000"}, +"body": [{"id": 1, +"content-type": "text/plain", +"content": "This is just a test message at /home/wsh/src/notmuch/test/trash directory.t0006-maildir/mail/msg-001:2,\n"}]}, +[]]]]' > show-expected + +test_expect_success 'Renamed message can be shown without running notmuch new' ' +notmuch show --format=json id:msg-001@notmuch-test-suite | filter_show > show-actual && +test_cmp show-expected show-actual +' + +test_expect_success 'Test that we can reply to the renamed message' ' +notmuch reply id:msg-001@notmuch-test-suite +' + +echo "No new mail." > expected +test_expect_success 'No rename should be detected by notmuch new' ' +increment_mtime "$(dirname "${gen_msg_filename}")" && +notmuch new > actual && +test_cmp expected actual +' +test_done diff --git a/test/test-lib.sh b/test/test-lib.sh index 5417fe7..917631b 100755 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -257,8 +257,11 @@ generate_message () local additional_headers gen_msg_cnt=$((gen_msg_cnt + 1)) - gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt) - gen_msg_id="${gen_msg_name}@notmuch-test-suite" + if [ -z "${template[filename]}" ]; then + template[filename]="msg-$(printf "%03d" $gen_msg_cnt)" + fi + gen_msg_name=${template[filename]} + gen_msg_id="${gen_msg_name%:2,*}@notmuch-test-suite" if [ -z "${template[dir]}" ]; then gen_msg_filename="${MAIL_DIR}/$gen_msg_name" -- 1.7.0