From ccf0d8dd4e3a9d0075f6c6966642d9d655b6d6b0 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sun, 13 Nov 2011 23:15:35 +0200 Subject: [PATCH] [PATCH v6 6/6] test: add tests for notmuch search --first and --maxitems --- 2b/a993cead7df8448f1eeb16f0eb20ecbf78c3c2 | 155 ++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 2b/a993cead7df8448f1eeb16f0eb20ecbf78c3c2 diff --git a/2b/a993cead7df8448f1eeb16f0eb20ecbf78c3c2 b/2b/a993cead7df8448f1eeb16f0eb20ecbf78c3c2 new file mode 100644 index 000000000..ffb91f189 --- /dev/null +++ b/2b/a993cead7df8448f1eeb16f0eb20ecbf78c3c2 @@ -0,0 +1,155 @@ +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 C0D4E429E32 + for ; Sun, 13 Nov 2011 13:16:13 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[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 I5fzeqOzaqV1 for ; + Sun, 13 Nov 2011 13:16:12 -0800 (PST) +Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com + [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B4A26429E34 + for ; Sun, 13 Nov 2011 13:16:02 -0800 (PST) +Received: by mail-bw0-f53.google.com with SMTP id q10so6289712bka.26 + for ; Sun, 13 Nov 2011 13:16:02 -0800 (PST) +Received: by 10.204.151.84 with SMTP id b20mr16625091bkw.22.1321218962122; + Sun, 13 Nov 2011 13:16:02 -0800 (PST) +Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi. + [80.220.92.23]) + by mx.google.com with ESMTPS id z7sm27635278bka.1.2011.11.13.13.15.59 + (version=SSLv3 cipher=OTHER); Sun, 13 Nov 2011 13:16:01 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH v6 6/6] test: add tests for notmuch search --first and + --maxitems +Date: Sun, 13 Nov 2011 23:15:35 +0200 +Message-Id: + <60203cbfdcee617a33155e50da9033972fc779f9.1321217854.git.jani@nikula.org> +X-Mailer: git-send-email 1.7.5.4 +In-Reply-To: +References: +In-Reply-To: +References: +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, 13 Nov 2011 21:16:14 -0000 + +Signed-off-by: Jani Nikula +--- + test/notmuch-test | 1 + + test/search-limiting | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 72 insertions(+), 0 deletions(-) + create mode 100755 test/search-limiting + +diff --git a/test/notmuch-test b/test/notmuch-test +index 587adb5..435b469 100755 +--- a/test/notmuch-test ++++ b/test/notmuch-test +@@ -25,6 +25,7 @@ TESTS=" + search-by-folder + search-position-overlap-bug + search-insufficient-from-quoting ++ search-limiting + json + multipart + thread-naming +diff --git a/test/search-limiting b/test/search-limiting +new file mode 100755 +index 0000000..45cc0a9 +--- /dev/null ++++ b/test/search-limiting +@@ -0,0 +1,71 @@ ++#!/usr/bin/env bash ++test_description='"notmuch search" --first and --maxitems parameters' ++. ./test-lib.sh ++ ++add_email_corpus ++ ++for outp in messages threads; do ++ test_begin_subtest "${outp}: maxitems does the right thing" ++ notmuch search --output=${outp} "*" | head -n 20 >expected ++ notmuch search --output=${outp} --maxitems=20 "*" >output ++ test_expect_equal_file expected output ++ ++ test_begin_subtest "${outp}: concatenation of limited searches" ++ notmuch search --output=${outp} "*" | head -n 20 >expected ++ notmuch search --output=${outp} --maxitems=10 "*" >output ++ notmuch search --output=${outp} --maxitems=10 --first=10 "*" >>output ++ test_expect_equal_file expected output ++ ++ test_begin_subtest "${outp}: maxitems larger than result set" ++ N=`notmuch count --output=${outp} "*"` ++ notmuch search --output=${outp} "*" >expected ++ notmuch search --output=${outp} --maxitems=$((1 + ${N})) "*" >output ++ test_expect_equal_file expected output ++ ++ test_begin_subtest "${outp}: maxitems = 0" ++ test_expect_equal "`notmuch search --output=${outp} --maxitems=0 "*"`" "" ++ ++ test_begin_subtest "${outp}: first does the right thing" ++ # note: tail -n +N is 1-based ++ notmuch search --output=${outp} "*" | tail -n +21 >expected ++ notmuch search --output=${outp} --first=20 "*" >output ++ test_expect_equal_file expected output ++ ++ test_begin_subtest "${outp}: first = 0" ++ notmuch search --output=${outp} "*" >expected ++ notmuch search --output=${outp} --first=0 "*" >output ++ test_expect_equal_file expected output ++ ++ test_begin_subtest "${outp}: negative first" ++ notmuch search --output=${outp} "*" | tail -n 20 >expected ++ notmuch search --output=${outp} --first=-20 "*" >output ++ test_expect_equal_file expected output ++ ++ test_begin_subtest "${outp}: negative first" ++ notmuch search --output=${outp} "*" | tail -n 1 >expected ++ notmuch search --output=${outp} --first=-1 "*" >output ++ test_expect_equal_file expected output ++ ++ test_begin_subtest "${outp}: negative first combined with maxitems" ++ notmuch search --output=${outp} "*" | tail -n 20 | head -n 10 >expected ++ notmuch search --output=${outp} --first=-20 --maxitems=10 "*" >output ++ test_expect_equal_file expected output ++ ++ test_begin_subtest "${outp}: negative first combined with equal maxitems" ++ notmuch search --output=${outp} "*" | tail -n 20 >expected ++ notmuch search --output=${outp} --first=-20 --maxitems=20 "*" >output ++ test_expect_equal_file expected output ++ ++ test_begin_subtest "${outp}: negative first combined with large maxitems" ++ notmuch search --output=${outp} "*" | tail -n 20 >expected ++ notmuch search --output=${outp} --first=-20 --maxitems=50 "*" >output ++ test_expect_equal_file expected output ++ ++ test_begin_subtest "${outp}: negative first larger then results" ++ N=`notmuch count --output=${outp} "*"` ++ notmuch search --output=${outp} "*" >expected ++ notmuch search --output=${outp} --first=-$((1 + ${N})) "*" >output ++ test_expect_equal_file expected output ++done ++ ++test_done +-- +1.7.5.4 + -- 2.26.2