From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 829AD431FD5 for ; Sun, 1 Jul 2012 09:47:14 -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 vz3QHKHt2eE5 for ; Sun, 1 Jul 2012 09:47:14 -0700 (PDT) Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id C2A98431FAF for ; Sun, 1 Jul 2012 09:47:13 -0700 (PDT) Received: by mail-wg0-f45.google.com with SMTP id dt14so3721202wgb.2 for ; Sun, 01 Jul 2012 09:47:13 -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; bh=mtYHygXgzv3nMRpX+wAW/18klYYP2+BiWuN+1uTQG1o=; b=DZMSliZMlucIORZe30/2QJGjnvV+NWML+j8xTi15r82PXe9cLoTmOMb/LWmTFB1tOa 8K1fGqb6NX4oQGF8UtAJy3SsV9y+uAULoWxaqlBfcR5jFqzlHcs6e/zas7oC7S9Pz3Sd hzHSz9Xa5Yig/tV0YPJiLTdJNX2NeQz3Kp5MkPm1nvJ/ujMKIHp1b6FdihA7nOVHzl6s 5Z9QTbphDDp+xlByaUpr929PRj0WMGXxFEEDqVu9hqi10T4TfisNXGJKBQ2pmhg6MyJU kSb1TDSycdLxUkZXbW6DPcZGAOjgd8JSPGqbiulkc9wHb9cwVUzWgukkPNZhvSpaLUAK ZDAA== Received: by 10.180.95.135 with SMTP id dk7mr17909232wib.14.1341161233408; Sun, 01 Jul 2012 09:47:13 -0700 (PDT) Received: from localhost ([195.24.209.21]) by mx.google.com with ESMTPS id k8sm35174447wia.6.2012.07.01.09.47.06 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 01 Jul 2012 09:47:12 -0700 (PDT) From: Ethan Glasser-Camp To: notmuch@notmuchmail.org Subject: [PATCH v2 7/8] Tests for mbox support Date: Sun, 1 Jul 2012 12:39:49 -0400 Message-Id: <1341160790-14525-8-git-send-email-ethan@betacantrips.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1341160790-14525-1-git-send-email-ethan@betacantrips.com> References: <1341160790-14525-1-git-send-email-ethan@betacantrips.com> Cc: Ethan Glasser-Camp 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, 01 Jul 2012 16:47:14 -0000 These are simple tests of one single mbox. Signed-off-by: Ethan Glasser-Camp --- The test uses bash arrays, which have a slightly odd syntax for appending. test/mbox | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ test/notmuch-test | 1 + 2 files changed, 64 insertions(+) create mode 100755 test/mbox diff --git a/test/mbox b/test/mbox new file mode 100755 index 0000000..a6dab99 --- /dev/null +++ b/test/mbox @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2005 Junio C Hamano +# + +test_description='basic mbox support' +. ./test-lib.sh + +mkdir -p $MAIL_DIR/some-mboxes/subdir $MAIL_DIR/database $MAIL_DIR/corpus + +# The Content-Length headers here include the final newline (added later). +generate_message '[body]="Mbox message 1."' '[header]="Content-Length: 16"' "[dir]=corpus" +generate_message '[body]="Mbox message 2. Longer."' '[header]="Content-Length: 24"' "[dir]=corpus" +generate_message '[body]="Mbox message 3."' "[dir]=corpus" +generate_message '[body]="Mbox message 4."' "[dir]=corpus" +generate_message '[body]="Mbox message 5. Last message."' '[header]="Content-Length: 30"' "[dir]=corpus" + +MBOX1=$MAIL_DIR/some-mboxes/first.mbox +declare -a starts lengths + +for x in $MAIL_DIR/corpus/*; do + echo "From MAILER-DAEMON Sat Jan 3 01:05:34 1996" >> $MBOX1 + starts+=(`wc -c $MBOX1 | cut -f 1 -d ' '`) + cat $x >> $MBOX1 + lengths+=(`wc -c $x | cut -f 1 -d ' '`) + # Final newline + echo >> $MBOX1 +done + +notmuch config set database.path $MAIL_DIR/database +notmuch config set new.scan mbox://$MAIL_DIR/some-mboxes + +test_begin_subtest "read a small mbox (5 messages)" +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "Added 5 new messages to the database." + +test_begin_subtest "search" +output=$(notmuch search '*' | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #1 (inbox unread) +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #2 (inbox unread) +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #3 (inbox unread) +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #4 (inbox unread) +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #5 (inbox unread)" + +test_begin_subtest "show (mboxcl)" +output=$(notmuch show "Test message #1" | grep -o "filename:[^ ]*") +test_expect_equal "$output" "filename:mbox://$MAIL_DIR/some-mboxes/first.mbox#${starts[0]}+${lengths[0]}" + +test_begin_subtest "show doesn't append an extra space at the end (mboxcl)" +output=$(notmuch show --format=raw "Test message #1" ) +original=$(cat $MAIL_DIR/corpus/msg-001) +test_expect_equal "$output" "$original" + +test_begin_subtest "show (non-cl)" +output=$(notmuch show "Test message #3" | grep -o "filename:[^ ]*") +test_expect_equal "$output" "filename:mbox://$MAIL_DIR/some-mboxes/first.mbox#${starts[2]}+${lengths[2]}" + +test_begin_subtest "show doesn't append an extra space at the end (non-cl)" +output=$(notmuch show --format=raw "Test message #3" ) +original=$(cat $MAIL_DIR/corpus/msg-003) +test_expect_equal "$output" "$original" + +test_done diff --git a/test/notmuch-test b/test/notmuch-test index bfad5d3..8cbb2cd 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -47,6 +47,7 @@ TESTS=" emacs-large-search-buffer emacs-subject-to-filename maildir-sync + mbox crypto symbol-hiding search-folder-coherence -- 1.7.9.5