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 340E8431FB6 for ; Mon, 25 Jun 2012 13:54:43 -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 UyyVazdViFw6 for ; Mon, 25 Jun 2012 13:54:42 -0700 (PDT) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 7547D431FAF for ; Mon, 25 Jun 2012 13:54:42 -0700 (PDT) Received: by wibhm2 with SMTP id hm2so404653wib.2 for ; Mon, 25 Jun 2012 13:54:41 -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=i9NQOH7lckEe+/g2VY3ccvykzEp2yzRhSd0LsPexHbo=; b=lwqEPzoeY/VVp0wNbasDihVmXsN64ZcmHQgVVrQw7RlKlosPBdlQguitOE9TJf1+S4 l/iZf3FrgkSSC4qRUmRT+KT1KaKi89t9WkNAQGorUlU1sKS/Bdhb5yFeCgRQgA4PTwW3 KnHYciMc6PQTPtBgRS02sk9AlrYp73Da+WPzw9YGSt61TeoNMUx4O76bgwTONTWRDN1I PDbTHZstkiPWrO7QfZtrrgvx8kRNiGYOeUgYpluvXVJZZcAnhANI2kYbGO172XolCUw+ 2bItHEmaWdbjDveB/l0w5+z+bBih99C4cCm0W/1GHU1vEis+8aeYBQLFCR+H44bLK3ea +4cw== Received: by 10.216.215.194 with SMTP id e44mr7462987wep.61.1340657681222; Mon, 25 Jun 2012 13:54:41 -0700 (PDT) Received: from localhost ([195.24.209.21]) by mx.google.com with ESMTPS id eb8sm17682wib.11.2012.06.25.13.54.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jun 2012 13:54:40 -0700 (PDT) From: Ethan Glasser-Camp To: notmuch@notmuchmail.org Subject: [RFC PATCH 13/14] Tests for mbox support Date: Mon, 25 Jun 2012 16:51:56 -0400 Message-Id: <1340657517-6539-9-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> 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:54:43 -0000 These need to be improved, rather than hard-coding byte offsets. Signed-off-by: Ethan Glasser-Camp --- test/mbox | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ test/notmuch-test | 1 + 2 files changed, 60 insertions(+) create mode 100755 test/mbox diff --git a/test/mbox b/test/mbox new file mode 100755 index 0000000..f03f887 --- /dev/null +++ b/test/mbox @@ -0,0 +1,59 @@ +#!/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 +for x in $MAIL_DIR/corpus/*; do + echo "From MAILER-DAEMON Sat Jan 3 01:05:34 1996" >> $MBOX1 + cat $x >> $MBOX1 + # 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#44+246" + +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#634+227" + +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