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 D6C46429E35 for ; Sat, 14 Jan 2012 00:59:43 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org 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 mkDZDz4znikZ for ; Sat, 14 Jan 2012 00:59:42 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 9777A431FB6 for ; Sat, 14 Jan 2012 00:59:42 -0800 (PST) Received: by werh12 with SMTP id h12so7105wer.26 for ; Sat, 14 Jan 2012 00:59:41 -0800 (PST) Received: by 10.216.133.19 with SMTP id p19mr520462wei.0.1326531581392; Sat, 14 Jan 2012 00:59:41 -0800 (PST) Received: from localhost ([109.131.75.86]) by mx.google.com with ESMTPS id fc6sm9708860wbb.16.2012.01.14.00.59.40 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 14 Jan 2012 00:59:40 -0800 (PST) From: Pieter Praet To: David Bremner Subject: [PATCH] test: cli: getting/setting/removing config values Date: Sat, 14 Jan 2012 09:57:56 +0100 Message-Id: <1326531476-14556-1-git-send-email-pieter@praet.org> X-Mailer: git-send-email 1.7.8.1 In-Reply-To: <8739bir7do.fsf@praet.org> References: <8739bir7do.fsf@praet.org> Cc: Notmuch Mail 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: Sat, 14 Jan 2012 08:59:44 -0000 Full test coverage for getting, setting and removing options in notmuch(1)'s config file ($NOTMUCH_CONFIG or $HOME/.notmuch-config). --- Please *do* take note of the FIXME in the last test! test/config | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ test/notmuch-test | 1 + 2 files changed, 89 insertions(+), 0 deletions(-) create mode 100755 test/config diff --git a/test/config b/test/config new file mode 100755 index 0000000..ee3126c --- /dev/null +++ b/test/config @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +test_description='notmuch config' +. ./test-lib.sh + + +config_options=( + "database.path" + "user.name" + "user.primary_email" + "user.other_email" + "new.tags" + "maildir.synchronize_flags" +) + + +test_begin_subtest 'getting config: "config get
."' +echo -n "" > OUTPUT +for i in ${config_options[*]} ; do + notmuch config get "${i}" +done >> OUTPUT +cat >EXPECTED <. [values ...]"' +notmuch config set database.path /path/to/maildir +notmuch config set user.name "User Name" +notmuch config set user.primary_email primary_email@notmuchmail.org +notmuch config set user.other_email alt1@notmuchmail.org alt2@notmuchmail.org +notmuch config set new.tags tag1 tag2 tag3 +notmuch config set maildir.synchronize_flags false +echo -n "" > OUTPUT +for i in ${config_options[*]} ; do + notmuch config get "${i}" +done >> OUTPUT +cat >EXPECTED <."' +notmuch config set database.path +notmuch config set user.name +notmuch config set user.primary_email +notmuch config set user.other_email +notmuch config set new.tags +notmuch config set maildir.synchronize_flags +echo -n "" > OUTPUT +for i in ${config_options[*]} ; do + notmuch config get "${i}" +done >> OUTPUT + +# FIXME: Not the most robust nor portable solution here... +# Especially `hostname --domain' may have unwanted effects on +# some platforms, e.g. setting your hostname to "--domain" ;) +fallback_name="$(grep $(id -un) /etc/passwd | cut -d ":" -f 5 | cut -d "," -f 1)" +fallback_email="$(id -un)@$(hostname).$(hostname --domain)" + +cat >EXPECTED <