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 C291D431FAE for ; Wed, 25 Jul 2012 06:44:41 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 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_DNSWL_LOW=-0.7] 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 NvrW0JT7jPaE for ; Wed, 25 Jul 2012 06:44:39 -0700 (PDT) Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com [209.85.160.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 06FE9431FB6 for ; Wed, 25 Jul 2012 06:44:29 -0700 (PDT) Received: by mail-pb0-f53.google.com with SMTP id rr13so1767731pbb.26 for ; Wed, 25 Jul 2012 06:44:29 -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=+SrQU1UNIJx5FBpebPtO/T3XksimAasvMcBpunplQjY=; b=tpJPYREEMERXhsy5BRgsqkCESL5BQYT/JAAKUvY+ms2iO90WVoGqT3l3uCkpom5vMn +/xvWK7wwkH2ZPqlABGaI/+9UEe9+h0p5XLTAnih1yG6JD85ojLeds6xt838VHJM3GwG 97PNS7CbEcQ3DBF0KNinn2LvdLe0l1Boq0O72EvEpkklDIvT0ypBP7WQMri1/6eDMp29 GjQHk1RPbLJK/xSMEMCcEuv5Zp5rp2n0bP9G4GBKNYu6aYcsUrO7Q2gZbzI0IUfegeZ3 Ed0yhvazhVvxT8uNGzh2aPbQ72Edy6Qb38PqnbWak0ijluhhnjqkFzB0V2qVE/0eTuYg p5hw== Received: by 10.68.224.233 with SMTP id rf9mr54371919pbc.141.1343223869417; Wed, 25 Jul 2012 06:44:29 -0700 (PDT) Received: from localhost (215.42.233.220.static.exetel.com.au. [220.233.42.215]) by mx.google.com with ESMTPS id gf3sm6124497pbc.74.2012.07.25.06.44.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jul 2012 06:44:28 -0700 (PDT) From: Peter Wang To: notmuch@notmuchmail.org Subject: [PATCH 13/18] test: add tests for insert Date: Wed, 25 Jul 2012 23:42:42 +1000 Message-Id: <1343223767-9812-13-git-send-email-novalazy@gmail.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1343223767-9812-1-git-send-email-novalazy@gmail.com> References: <1343223767-9812-1-git-send-email-novalazy@gmail.com> 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: Wed, 25 Jul 2012 13:44:42 -0000 Add tests for new 'insert' command. --- test/insert | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ test/notmuch-test | 1 + 2 files changed, 54 insertions(+), 0 deletions(-) create mode 100755 test/insert diff --git a/test/insert b/test/insert new file mode 100755 index 0000000..3514920 --- /dev/null +++ b/test/insert @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +test_description='"notmuch insert"' +. ./test-lib.sh + +# Create directories and database before inserting. +mkdir -p "$MAIL_DIR"/{cur,new,tmp} +mkdir -p "$MAIL_DIR"/Drafts/{cur,new,tmp} +notmuch new > /dev/null + +# We use generate_message to create the temporary message file. +# It happens to be in the mail directory already but that is okay. + +test_begin_subtest "Insert message, default" +generate_message \ + "[subject]=\"insert-subject\"" \ + "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ + "[body]=\"insert-message\"" +notmuch insert < "$gen_msg_filename" +test_expect_equal "`notmuch count subject:insert-subject tag:unread`" "1" + +test_begin_subtest "Insert message, add tag" +generate_message \ + "[subject]=\"insert-subject-addtag\"" \ + "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ + "[body]=\"insert-message-addtag\"" +notmuch insert +custom < "$gen_msg_filename" +test_expect_equal "`notmuch count tag:custom`" "1" + +test_begin_subtest "Insert message, add/remove tag" +generate_message \ + "[subject]=\"insert-subject-addrmtag\"" \ + "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ + "[body]=\"insert-message-addrmtag\"" +notmuch insert -- +custom -unread < "$gen_msg_filename" +test_expect_equal "`notmuch count tag:custom NOT tag:unread`" "1" + +test_begin_subtest "Insert message, folder" +generate_message \ + "[subject]=\"insert-subject-draft\"" \ + "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ + "[body]=\"insert-message-draft\"" +notmuch insert --folder=Drafts < "$gen_msg_filename" +test_expect_equal "`notmuch count folder:Drafts`" "1" + +test_begin_subtest "Insert message, folder and tags" +generate_message \ + "[subject]=\"insert-subject-draft\"" \ + "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ + "[body]=\"insert-message-draft\"" +notmuch insert --folder=Drafts -- +draft -unread < "$gen_msg_filename" +test_expect_equal "`notmuch count folder:Drafts tag:draft NOT tag:unread`" "1" + +test_done diff --git a/test/notmuch-test b/test/notmuch-test index ea39dfc..b40ba0b 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -22,6 +22,7 @@ TESTS=" config new count + insert search search-output search-by-folder -- 1.7.4.4