From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id DD4956DE1204 for ; Sun, 1 Oct 2017 13:53:41 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: 0.016 X-Spam-Level: X-Spam-Status: No, score=0.016 tagged_above=-999 required=5 tests=[AWL=0.036, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0cBDRFyzhIdk for ; Sun, 1 Oct 2017 13:53:41 -0700 (PDT) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by arlo.cworth.org (Postfix) with ESMTPS id E7A4C6DE1205 for ; Sun, 1 Oct 2017 13:53:35 -0700 (PDT) Received: by mail-lf0-f68.google.com with SMTP id q132so1480745lfe.4 for ; Sun, 01 Oct 2017 13:53:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=rgwwktprAcNovUtUpFnceguFgi2uhJF7kO3ygqe41qk=; b=vmcnjEa4tXyqAtvQR+NBEAq+o2pQX79+oFHeLejWwOBWZpFu37LajmUs5dX89ra4ut aV54WZe01+CnzAiaVFwxxyceDJX3rQlV8VojPWC2Emuxe6mVY7V21xDasF6UTqYLGdLq JPl00XYUTml4pTqtcbt7m2jyxNZ0/biQMtOoHY/0tcLKdIgNNpo0VLXjDx8eJh3iUtWJ V+0uy52WGPs21RbXTbrLthrj0j+etXB2wX5kPHLy1Jl6vcdnjC4FTRU5/AKmKX6MhloO zhFEWxZLGuO1rCYvGvwOL64PKjH0dX3dEmdqMn2LiRec/M7y1fTqbBl9tXLs46vjfqtj ErVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=rgwwktprAcNovUtUpFnceguFgi2uhJF7kO3ygqe41qk=; b=cvnQyTG82uoL4WtI1HZzX+CemDeQ/3ur7Y/F/FfIHtiIDQ5SK3efw13qHhPIkBx4rv mPTipX+LFLcukNvE17HLmcbJdeJhIjcNXg4tntgn8Gqe5zmR3bWcFQvurCXlft8QrviX jg9Mkayy/GXnm+Ioz+Oq6kqIYTaPZU6jXIWxj0nwuRVeypWy+E5bdXhvQaDXuSqwQoY9 7FPnDZojxK3JWU1NX0z+d26C1z1dLBaQ9JNVSOP+4Zu4OiWCuxUEjuUapaOVsaaEcnV0 +Wxq3d12+/ytFXf9Tvq41sY+20tFLo79yqIJYiiy3Qvlcf3mBIFjmNBh0TMvvT2P/5aK yRBA== X-Gm-Message-State: AHPjjUibgny91L14WfGU3NwESZz6nuy4tpDCedWbxBpLDnvQcU5nLGfB bI/OygakBn1pvb7eQgBGqIS2G98tDJ8= X-Google-Smtp-Source: AOwi7QANMKwBo+bx2FFecxSAGNbNZe+C88KFw/b5Tv+TiezxczQ3415GIaZdBFk1Vt76DcNaPYs8LQ== X-Received: by 10.46.22.4 with SMTP id w4mr6273701ljd.21.1506891214146; Sun, 01 Oct 2017 13:53:34 -0700 (PDT) Received: from localhost (mobile-access-5d6a60-234.dhcp.inet.fi. [93.106.96.234]) by smtp.gmail.com with ESMTPSA id l14sm39795lfb.7.2017.10.01.13.53.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 01 Oct 2017 13:53:33 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Cc: jani@nikula.org, David Bremner , Daniel Kahn Gillmor Subject: [PATCH v2 03/15] test: add boolean argument to arg-test Date: Sun, 1 Oct 2017 23:53:12 +0300 Message-Id: <0dd6fe2caf3d4f72f79eb2b1ad675291489c415d.1506890421.git.jani@nikula.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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, 01 Oct 2017 20:53:42 -0000 Surprisingly it's not there. --- test/T410-argument-parsing.sh | 3 ++- test/arg-test.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/T410-argument-parsing.sh b/test/T410-argument-parsing.sh index fad134e305c5..4505c58301ea 100755 --- a/test/T410-argument-parsing.sh +++ b/test/T410-argument-parsing.sh @@ -3,8 +3,9 @@ test_description="argument parsing" . ./test-lib.sh || exit 1 test_begin_subtest "sanity check" -$TEST_DIRECTORY/arg-test pos1 --keyword=one --string=foo pos2 --int=7 --flag=one --flag=three > OUTPUT +$TEST_DIRECTORY/arg-test pos1 --keyword=one --boolean --string=foo pos2 --int=7 --flag=one --flag=three > OUTPUT cat < EXPECTED +boolean 1 keyword 1 flags 5 int 7 diff --git a/test/arg-test.c b/test/arg-test.c index 10dc06834513..9d13618bd17c 100644 --- a/test/arg-test.c +++ b/test/arg-test.c @@ -12,8 +12,10 @@ int main(int argc, char **argv){ const char *pos_arg1=NULL; const char *pos_arg2=NULL; const char *string_val=NULL; + notmuch_bool_t bool_val = FALSE; notmuch_opt_desc_t options[] = { + { .opt_bool = &bool_val, .name = "boolean" }, { .opt_keyword = &kw_val, .name = "keyword", .keywords = (notmuch_keyword_t []){ { "one", 1 }, { "two", 2 }, @@ -35,6 +37,9 @@ int main(int argc, char **argv){ if (opt_index < 0) return 1; + if (bool_val) + printf("boolean %d\n", bool_val); + if (kw_val) printf("keyword %d\n", kw_val); -- 2.11.0