--- /dev/null
+Return-Path: <ethan.glasser.camp@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 829AD431FD5\r
+ for <notmuch@notmuchmail.org>; Sun, 1 Jul 2012 09:47:14 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.061\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.061 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_BL_SPAMCOP_NET=1.246,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_WEB=0.614] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id vz3QHKHt2eE5 for <notmuch@notmuchmail.org>;\r
+ Sun, 1 Jul 2012 09:47:14 -0700 (PDT)\r
+Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com\r
+ [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ C2A98431FAF for <notmuch@notmuchmail.org>; Sun, 1 Jul 2012 09:47:13 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f45.google.com with SMTP id dt14so3721202wgb.2\r
+ for <notmuch@notmuchmail.org>; Sun, 01 Jul 2012 09:47:13 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=mtYHygXgzv3nMRpX+wAW/18klYYP2+BiWuN+1uTQG1o=;\r
+ b=DZMSliZMlucIORZe30/2QJGjnvV+NWML+j8xTi15r82PXe9cLoTmOMb/LWmTFB1tOa\r
+ 8K1fGqb6NX4oQGF8UtAJy3SsV9y+uAULoWxaqlBfcR5jFqzlHcs6e/zas7oC7S9Pz3Sd\r
+ hzHSz9Xa5Yig/tV0YPJiLTdJNX2NeQz3Kp5MkPm1nvJ/ujMKIHp1b6FdihA7nOVHzl6s\r
+ 5Z9QTbphDDp+xlByaUpr929PRj0WMGXxFEEDqVu9hqi10T4TfisNXGJKBQ2pmhg6MyJU\r
+ kSb1TDSycdLxUkZXbW6DPcZGAOjgd8JSPGqbiulkc9wHb9cwVUzWgukkPNZhvSpaLUAK\r
+ ZDAA==\r
+Received: by 10.180.95.135 with SMTP id dk7mr17909232wib.14.1341161233408;\r
+ Sun, 01 Jul 2012 09:47:13 -0700 (PDT)\r
+Received: from localhost ([195.24.209.21])\r
+ by mx.google.com with ESMTPS id k8sm35174447wia.6.2012.07.01.09.47.06\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sun, 01 Jul 2012 09:47:12 -0700 (PDT)\r
+From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 7/8] Tests for mbox support\r
+Date: Sun, 1 Jul 2012 12:39:49 -0400\r
+Message-Id: <1341160790-14525-8-git-send-email-ethan@betacantrips.com>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <1341160790-14525-1-git-send-email-ethan@betacantrips.com>\r
+References:\r
+ <CAOJ+Ob0MSOez2MvD2fCgF7t32kFPk4g2+xCud88QmBLt_b5pOA@mail.gmail.com>\r
+ <1341160790-14525-1-git-send-email-ethan@betacantrips.com>\r
+Cc: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 01 Jul 2012 16:47:14 -0000\r
+\r
+These are simple tests of one single mbox.\r
+\r
+Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+---\r
+The test uses bash arrays, which have a slightly odd syntax for\r
+appending.\r
+\r
+ test/mbox | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+ test/notmuch-test | 1 +\r
+ 2 files changed, 64 insertions(+)\r
+ create mode 100755 test/mbox\r
+\r
+diff --git a/test/mbox b/test/mbox\r
+new file mode 100755\r
+index 0000000..a6dab99\r
+--- /dev/null\r
++++ b/test/mbox\r
+@@ -0,0 +1,63 @@\r
++#!/usr/bin/env bash\r
++#\r
++# Copyright (c) 2005 Junio C Hamano\r
++#\r
++\r
++test_description='basic mbox support'\r
++. ./test-lib.sh\r
++\r
++mkdir -p $MAIL_DIR/some-mboxes/subdir $MAIL_DIR/database $MAIL_DIR/corpus\r
++\r
++# The Content-Length headers here include the final newline (added later).\r
++generate_message '[body]="Mbox message 1."' '[header]="Content-Length: 16"' "[dir]=corpus"\r
++generate_message '[body]="Mbox message 2. Longer."' '[header]="Content-Length: 24"' "[dir]=corpus"\r
++generate_message '[body]="Mbox message 3."' "[dir]=corpus"\r
++generate_message '[body]="Mbox message 4."' "[dir]=corpus"\r
++generate_message '[body]="Mbox message 5. Last message."' '[header]="Content-Length: 30"' "[dir]=corpus"\r
++\r
++MBOX1=$MAIL_DIR/some-mboxes/first.mbox\r
++declare -a starts lengths\r
++\r
++for x in $MAIL_DIR/corpus/*; do\r
++ echo "From MAILER-DAEMON Sat Jan 3 01:05:34 1996" >> $MBOX1\r
++ starts+=(`wc -c $MBOX1 | cut -f 1 -d ' '`)\r
++ cat $x >> $MBOX1\r
++ lengths+=(`wc -c $x | cut -f 1 -d ' '`)\r
++ # Final newline\r
++ echo >> $MBOX1\r
++done\r
++\r
++notmuch config set database.path $MAIL_DIR/database\r
++notmuch config set new.scan mbox://$MAIL_DIR/some-mboxes\r
++\r
++test_begin_subtest "read a small mbox (5 messages)"\r
++output=$(NOTMUCH_NEW)\r
++test_expect_equal "$output" "Added 5 new messages to the database."\r
++\r
++test_begin_subtest "search"\r
++output=$(notmuch search '*' | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #1 (inbox unread)\r
++thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #2 (inbox unread)\r
++thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #3 (inbox unread)\r
++thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #4 (inbox unread)\r
++thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #5 (inbox unread)"\r
++\r
++test_begin_subtest "show (mboxcl)"\r
++output=$(notmuch show "Test message #1" | grep -o "filename:[^ ]*")\r
++test_expect_equal "$output" "filename:mbox://$MAIL_DIR/some-mboxes/first.mbox#${starts[0]}+${lengths[0]}"\r
++\r
++test_begin_subtest "show doesn't append an extra space at the end (mboxcl)"\r
++output=$(notmuch show --format=raw "Test message #1" )\r
++original=$(cat $MAIL_DIR/corpus/msg-001)\r
++test_expect_equal "$output" "$original"\r
++\r
++test_begin_subtest "show (non-cl)"\r
++output=$(notmuch show "Test message #3" | grep -o "filename:[^ ]*")\r
++test_expect_equal "$output" "filename:mbox://$MAIL_DIR/some-mboxes/first.mbox#${starts[2]}+${lengths[2]}"\r
++\r
++test_begin_subtest "show doesn't append an extra space at the end (non-cl)"\r
++output=$(notmuch show --format=raw "Test message #3" )\r
++original=$(cat $MAIL_DIR/corpus/msg-003)\r
++test_expect_equal "$output" "$original"\r
++\r
++test_done\r
+diff --git a/test/notmuch-test b/test/notmuch-test\r
+index bfad5d3..8cbb2cd 100755\r
+--- a/test/notmuch-test\r
++++ b/test/notmuch-test\r
+@@ -47,6 +47,7 @@ TESTS="\r
+ emacs-large-search-buffer\r
+ emacs-subject-to-filename\r
+ maildir-sync\r
++ mbox\r
+ crypto\r
+ symbol-hiding\r
+ search-folder-coherence\r
+-- \r
+1.7.9.5\r
+\r