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 4AB30431FD4 for ; Sat, 22 Jun 2013 21:26:05 -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 1zmW-Q9MZY3d for ; Sat, 22 Jun 2013 21:25:58 -0700 (PDT) Received: from mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 9EA6B429E49 for ; Sat, 22 Jun 2013 21:24:58 -0700 (PDT) Received: by mail-pb0-f47.google.com with SMTP id rr13so9537560pbb.20 for ; Sat, 22 Jun 2013 21:24:58 -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=YPwR379/zV05Okgh5XP41HNIKRY8a0jyAtZZVJLMf7E=; b=rtnBa9uBwEBN0Q58HzNzreIlIyDoV8td4EYBL0Dhgxif/hQgqSrHe9vGQcfh+q6bE/ dHgDILZaRCrJY6wW520pLRxKQxN0n3f1QGScr2oGbZqA/6YUWiwvqnL5HvsH5VKlPetl 8YePQrH9iQjhG+ZBuAkOT+gLChAqzGs5wt/D3hjZyXzzN2gT1ORBz7oJSmVqsTJwns8K QGTceP23mNxUXnPzZYxEwHmv5BjBWPlWJ1LH2s7l/HIiVy195C+DiqchG247ayaMVopw zt8E4YrUyKDaNCumqSGG0gbB2s0yXkbWuNwsc3s/jB1iZ6vxyuuBfD9hBWvp82TR+jN6 gg1Q== X-Received: by 10.66.218.39 with SMTP id pd7mr22194494pac.148.1371961497947; Sat, 22 Jun 2013 21:24:57 -0700 (PDT) Received: from localhost (215.42.233.220.static.exetel.com.au. [220.233.42.215]) by mx.google.com with ESMTPSA id bg3sm11814694pbb.44.2013.06.22.21.24.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 22 Jun 2013 21:24:57 -0700 (PDT) From: Peter Wang To: notmuch@notmuchmail.org Subject: [PATCH v7 12/12] test: test insert --create-folder option Date: Sun, 23 Jun 2013 14:24:05 +1000 Message-Id: <1371961445-15182-13-git-send-email-novalazy@gmail.com> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1371961445-15182-1-git-send-email-novalazy@gmail.com> References: <1371961445-15182-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: Sun, 23 Jun 2013 04:26:05 -0000 Add tests for notmuch insert --create-folder option. --- test/insert | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/insert b/test/insert index f573c76..021edb6 100755 --- a/test/insert +++ b/test/insert @@ -94,4 +94,28 @@ gen_insert_msg test_expect_code 1 "Insert message into non-existent folder" \ "notmuch insert --folder=nonesuch < $gen_msg_filename" +test_begin_subtest "Insert message, create folder" +gen_insert_msg +notmuch insert --folder=F --create-folder +folder < "$gen_msg_filename" +output=$(notmuch search --output=files folder:F tag:folder) +basename=$(basename "$output") +test_expect_equal_file "$gen_msg_filename" "$MAIL_DIR/F/cur/${basename}" + +test_begin_subtest "Insert message, create subfolder" +gen_insert_msg +notmuch insert --folder=F/G/H/I/J --create-folder +folder < "$gen_msg_filename" +output=$(notmuch search --output=files folder:F/G/H/I/J tag:folder) +basename=$(basename "$output") +test_expect_equal_file "$gen_msg_filename" "${MAIL_DIR}/F/G/H/I/J/cur/${basename}" + +test_begin_subtest "Insert message, create existing subfolder" +gen_insert_msg +notmuch insert --folder=F/G/H/I/J --create-folder +folder < "$gen_msg_filename" +output=$(notmuch count folder:F/G/H/I/J tag:folder) +test_expect_equal "$output" "2" + +gen_insert_msg +test_expect_code 1 "Insert message, create invalid subfolder" \ + "notmuch insert --folder=../G --create-folder $gen_msg_filename" + test_done -- 1.7.12.1