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 888F4431FBF for ; Tue, 24 Jan 2012 07:46:26 -0800 (PST) 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 HoPA-ZqMYnis for ; Tue, 24 Jan 2012 07:46:26 -0800 (PST) Received: from mail-bk0-f53.google.com (mail-bk0-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 BA82B431FBC for ; Tue, 24 Jan 2012 07:46:25 -0800 (PST) Received: by bkbzt19 with SMTP id zt19so2494443bkb.26 for ; Tue, 24 Jan 2012 07:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type; bh=GHaqwCqTkHnrJsu6HXOgqbvWLLZLBrZQfm+7qKRDep4=; b=l+VGU4fCB5rH7RzT7irdL70WrN6phUeLiAjHu7kvyM3RsMaXzGtF+XMw+tCtqQu/Qk 4ZQlZ0JCjQMMDZ24D3tdxAA0oi9wKh/mlN+6OIFx/HWPNzNYjpMGaR/oYz2JPH5ugR/K w2KsCKUyctsZF+sZLgU9uutohGuS3bBP00JuA= Received: by 10.204.195.130 with SMTP id ec2mr5322358bkb.106.1327419984423; Tue, 24 Jan 2012 07:46:24 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id ek9sm37129348bkb.10.2012.01.24.07.46.23 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jan 2012 07:46:23 -0800 (PST) From: Dmitry Kurochkin To: David Edmondson , notmuch@notmuchmail.org Subject: Re: [PATCH 3/4 v42] test: Add more helpers for emacs tests. In-Reply-To: <1327341947-29206-3-git-send-email-dme@dme.org> References: <1326804748-8989-2-git-send-email-dme@dme.org> <1327341947-29206-1-git-send-email-dme@dme.org> <1327341947-29206-3-git-send-email-dme@dme.org> User-Agent: Notmuch/0.11+100~gd650abf (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Tue, 24 Jan 2012 19:45:18 +0400 Message-ID: <8762g1m7e9.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Tue, 24 Jan 2012 15:46:26 -0000 On Mon, 23 Jan 2012 18:05:46 +0000, David Edmondson wrote: > --- > > Split out from the tests and re-factored. > > test/test-lib.el | 22 ++++++++++++++++++++++ > 1 files changed, 22 insertions(+), 0 deletions(-) > > diff --git a/test/test-lib.el b/test/test-lib.el > index 96752f0..c4a5db4 100644 > --- a/test/test-lib.el > +++ b/test/test-lib.el > @@ -20,6 +20,8 @@ > ;; > ;; Authors: Dmitry Kurochkin > > +(require 'cl) ;; This code is generally used uncompiled. > + > ;; `read-file-name' by default uses `completing-read' function to read > ;; user input. It does not respect `standard-input' variable which we > ;; use in tests to provide user input. So replace it with a plain > @@ -92,3 +94,23 @@ nothing." > result > (prin1-to-string result))) > (test-output)))) > + > +(defun notmuch-test-report-unexpected (output expected) > + "Report that the OUTPUT does not match the EXPECTED result." > + (concat "Expect:\t" (prin1-to-string expected) "\n" > + "Output:\t" (prin1-to-string output) "\n")) > + > +(defun notmuch-test-compare (output expected) > + "Compare OUTPUT with EXPECTED. Report any discrepencies." > + (if (equal output expected) > + t > + (cond > + ((and (listp output) > + (listp expected)) > + (apply #'concat (loop for o in output > + for e in expected > + if (not (equal o e)) > + collect (notmuch-test-report-unexpected o e)))) > + > + (t > + (notmuch-test-report-unexpected output expected))))) As we discussed it on IRC, I have two comments on the above code: 1. rename notmuch-test-compare to notmuch-test-expect-equal 2. move the top level equal check to the non-list branch But both of these are subjective and minor, so I leave it to David to decide whether to change or ignore them. Otherwise, the patch looks good to me. While replying to this email, I noticed a trailing whitespace. I may have missed them in other patches. David, can you please check for trailing white spaces and clean them? Regards, Dmitry > -- > 1.7.8.3 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch