From: Ethan Glasser-Camp Date: Mon, 25 Jun 2012 20:51:50 +0000 (+2000) Subject: [RFC PATCH 07/14] Update tests that need to see filenames to use URIs X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=49d3e2e090f6756bb389298003ede7d08b3e9ab3;p=notmuch-archives.git [RFC PATCH 07/14] Update tests that need to see filenames to use URIs --- diff --git a/06/9a015ba0072f0792dc24514ee4fc485d9d05c0 b/06/9a015ba0072f0792dc24514ee4fc485d9d05c0 new file mode 100644 index 000000000..b9940b9cb --- /dev/null +++ b/06/9a015ba0072f0792dc24514ee4fc485d9d05c0 @@ -0,0 +1,249 @@ +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 DC5CE431FB6 + for ; Mon, 25 Jun 2012 13:52:55 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 1.061 +X-Spam-Level: * +X-Spam-Status: No, score=1.061 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_BL_SPAMCOP_NET=1.246, + RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_WEB=0.614] 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 pay1ur-mReCD for ; + Mon, 25 Jun 2012 13:52:54 -0700 (PDT) +Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com + [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 352F0431FAF + for ; Mon, 25 Jun 2012 13:52:54 -0700 (PDT) +Received: by wibhm6 with SMTP id hm6so2196032wib.2 + for ; Mon, 25 Jun 2012 13:52:51 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references + :mime-version:content-type:content-transfer-encoding; + bh=Mhw/LYIt+bgFVRXJQ4iuJnciJWZ9Oc/emnbTCdY9KXU=; + b=gcqO5KMGFNQ8AtWUrjkiSSbSYYHyjgWsixPHm2jqxy49LEw247/QauAKPrNtEiFLQS + xK4ktraR3lXZkaCztKJ+8dMZkQ7FjAqwLvACzX0Tx4AW6WZniFYr488YtkZ7S1C9TTEF + aGyVCLPZMpwyO/iq8rCs64BulYgEw2d5NFFuiM9lG1ulWZkf9yU/ai9GImX5mLHtZkco + 8GnTGy5khcNC14+yapVpkvizK5QjtqauzGDcwyFBqWVZrBGQd2/ocoYGk1aF3Ae8gT9X + /q1FgdabILyCB6FRzzyVGQoiVoydTtETAnF1s28puSd/g+GzwQ1JHNFdXatTCVeQi47G + imYQ== +Received: by 10.180.14.165 with SMTP id q5mr27186173wic.8.1340657571500; + Mon, 25 Jun 2012 13:52:51 -0700 (PDT) +Received: from localhost ([195.24.209.21]) + by mx.google.com with ESMTPS id eu4sm38226wib.2.2012.06.25.13.52.46 + (version=TLSv1/SSLv3 cipher=OTHER); + Mon, 25 Jun 2012 13:52:50 -0700 (PDT) +From: Ethan Glasser-Camp +To: notmuch@notmuchmail.org +Subject: [RFC PATCH 07/14] Update tests that need to see filenames to use URIs +Date: Mon, 25 Jun 2012 16:51:50 -0400 +Message-Id: <1340657517-6539-3-git-send-email-ethan@betacantrips.com> +X-Mailer: git-send-email 1.7.9.5 +In-Reply-To: <1340657517-6539-1-git-send-email-ethan@betacantrips.com> +References: <1340657517-6539-1-git-send-email-ethan@betacantrips.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +X-Mailman-Approved-At: Tue, 26 Jun 2012 03:51:54 -0700 +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: Mon, 25 Jun 2012 20:52:56 -0000 + +This fixes all tests except atomicity, which should be next. + +Signed-off-by: Ethan Glasser-Camp +--- + test/emacs | 2 +- + test/json | 4 ++-- + test/maildir-sync | 7 ++++--- + test/multipart | 4 ++-- + test/new | 6 +++--- + test/search-folder-coherence | 2 +- + test/search-output | 4 ++-- + test/test-lib.sh | 3 +++ + 8 files changed, 18 insertions(+), 14 deletions(-) + +diff --git a/test/emacs b/test/emacs +index e9f954c..c08791e 100755 +--- a/test/emacs ++++ b/test/emacs +@@ -621,7 +621,7 @@ Stash my stashables + id:"bought" + bought + inbox,stashtest +-${gen_msg_filename} ++${gen_msg_uri} + http://mid.gmane.org/bought + http://marc.info/?i=bought + http://mail-archive.com/search?l=mid&q=bought +diff --git a/test/json b/test/json +index 6439788..be29fac 100755 +--- a/test/json ++++ b/test/json +@@ -5,7 +5,7 @@ test_description="--format=json output" + test_begin_subtest "Show message: json" + add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-show-message\"" + output=$(notmuch show --format=json "json-show-message") +-test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite \", \"To\": \"Notmuch Test Suite \", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]" ++test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_uri}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite \", \"To\": \"Notmuch Test Suite \", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]" + + test_begin_subtest "Search message: json" + add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-search-message\"" +@@ -22,7 +22,7 @@ test_expect_equal "$output" "[{\"thread\": \"XXX\", + test_begin_subtest "Show message: json, utf-8" + add_message "[subject]=\"json-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\"" + output=$(notmuch show --format=json "jsön-show-méssage") +-test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite \", \"To\": \"Notmuch Test Suite \", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]" ++test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_uri}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite \", \"To\": \"Notmuch Test Suite \", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]" + + test_begin_subtest "Show message: json, inline attachment filename" + subject='json-show-inline-attachment-filename' +diff --git a/test/maildir-sync b/test/maildir-sync +index 01348d3..a2e110e 100755 +--- a/test/maildir-sync ++++ b/test/maildir-sync +@@ -8,7 +8,7 @@ test_description="maildir synchronization" + # --format=json" output includes some newlines. Also, need to avoid + # including the local value of MAIL_DIR in the result. + filter_show_json() { +- sed -e 's/, /,\n/g' | sed -e "s|${MAIL_DIR}/|MAIL_DIR/|" ++ sed -e 's/, /,\n/g' | sed -e "s|${MAIL_URI}/|MAIL_DIR/|" + echo + } + +@@ -102,8 +102,9 @@ No new mail. Detected 1 file rename. + thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Removing S flag (inbox unread)" + + test_begin_subtest "Removing info from filename leaves tags unchanged" +-add_message [subject]='"Message to lose maildir info"' [filename]='message-to-lose-maildir-info' [dir]=cur +-notmuch tag -unread subject:"Message to lose maildir info" ++generate_message [subject]='"Message to lose maildir info"' [filename]='message-to-lose-maildir-info' [dir]=cur ++notmuch new > hrngh.new ++notmuch tag -unread subject:"Message to lose maildir info" > hrngh.tag + mv "$MAIL_DIR/cur/message-to-lose-maildir-info:2,S" "$MAIL_DIR/cur/message-without-maildir-info" + output=$(NOTMUCH_NEW) + output+=" +diff --git a/test/multipart b/test/multipart +index 72d3927..ccf410b 100755 +--- a/test/multipart ++++ b/test/multipart +@@ -109,7 +109,7 @@ notmuch new > /dev/null + test_begin_subtest "--format=text --part=0, full message" + notmuch show --format=text --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- +message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 excluded:0 filename:${MAIL_DIR}/multipart ++ +message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 excluded:0 filename:${MAIL_URI}/multipart + +header{ + Carl Worth (2001-01-05) (attachment inbox signed unread) + Subject: Multipart message +@@ -323,7 +323,7 @@ notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | s + echo >>OUTPUT # expect *no* newline at end of output + cat <EXPECTED + +-{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "excluded": false, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [ ++{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "excluded": false, "filename": "${MAIL_URI}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [ + {"id": 1, "content-type": "multipart/signed", "content": [ + {"id": 2, "content-type": "multipart/mixed", "content": [ + {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ +diff --git a/test/new b/test/new +index cab7c01..e7852ec 100755 +--- a/test/new ++++ b/test/new +@@ -171,9 +171,9 @@ touch "${MAIL_DIR}"/ignored_file + touch "${MAIL_DIR}"/.ignored_hidden_file + output=$(NOTMUCH_NEW 2>&1) + test_expect_equal "$output" \ +-"Note: Ignoring non-mail file: ${MAIL_DIR}/.git/config +-Note: Ignoring non-mail file: ${MAIL_DIR}/.ignored_hidden_file +-Note: Ignoring non-mail file: ${MAIL_DIR}/ignored_file ++"Note: Ignoring non-mail file: ${MAIL_URI}/.git/config ++Note: Ignoring non-mail file: ${MAIL_URI}/.ignored_hidden_file ++Note: Ignoring non-mail file: ${MAIL_URI}/ignored_file + Added 1 new message to the database." + + test_begin_subtest "Ignore files and directories specified in new.ignore" +diff --git a/test/search-folder-coherence b/test/search-folder-coherence +index 3f6ec76..08558db 100755 +--- a/test/search-folder-coherence ++++ b/test/search-folder-coherence +@@ -27,7 +27,7 @@ cat <EXPECTED + MAIL_DIR/msg-001 + MAIL_DIR/spam/msg-001 + EOF +-notmuch search --output=files id:$id_x | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT ++notmuch search --output=files id:$id_x | sed -e "s,$MAIL_URI,MAIL_DIR," >OUTPUT + test_expect_equal_file OUTPUT EXPECTED + + test_begin_subtest "Test matches folder:spam" +diff --git a/test/search-output b/test/search-output +index 8b57a43..d038dc7 100755 +--- a/test/search-output ++++ b/test/search-output +@@ -181,7 +181,7 @@ EOF + test_expect_equal_file OUTPUT EXPECTED + + test_begin_subtest "--output=files" +-notmuch search --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT ++notmuch search --output=files '*' | sed -e "s,$MAIL_URI,MAIL_DIR," >OUTPUT + cat <EXPECTED + MAIL_DIR/cur/52:2, + MAIL_DIR/cur/53:2, +@@ -240,7 +240,7 @@ EOF + test_expect_equal_file OUTPUT EXPECTED + + test_begin_subtest "--output=files --format=json" +-notmuch search --format=json --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT ++notmuch search --format=json --output=files '*' | sed -e "s,$MAIL_URI,MAIL_DIR," >OUTPUT + cat <EXPECTED + ["MAIL_DIR/cur/52:2,", + "MAIL_DIR/cur/53:2,", +diff --git a/test/test-lib.sh b/test/test-lib.sh +index 06aaea2..195158c 100644 +--- a/test/test-lib.sh ++++ b/test/test-lib.sh +@@ -287,6 +287,7 @@ generate_message () + + gen_msg_cnt=$((gen_msg_cnt + 1)) + if [ -z "${template[filename]}" ]; then ++ + gen_msg_name="msg-$(printf "%03d" $gen_msg_cnt)" + else + gen_msg_name=${template[filename]} +@@ -304,6 +305,7 @@ generate_message () + gen_msg_filename="${MAIL_DIR}/${template[dir]}/$gen_msg_name" + mkdir -p "$(dirname "$gen_msg_filename")" + fi ++ gen_msg_uri=maildir://$gen_msg_filename + + if [ -z "${template[body]}" ]; then + template[body]="This is just a test message (#${gen_msg_cnt})" +@@ -1149,6 +1151,7 @@ export HOME="${TMP_DIRECTORY}/home" + mkdir -p "${HOME}" + + MAIL_DIR="${TMP_DIRECTORY}/mail" ++MAIL_URI=maildir://$MAIL_DIR + export GNUPGHOME="${TMP_DIRECTORY}/gnupg" + export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config" + +-- +1.7.9.5 +