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 4271F6DE1151 for ; Tue, 19 Sep 2017 13:39:57 -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.036 X-Spam-Level: X-Spam-Status: No, score=0.036 tagged_above=-999 required=5 tests=[AWL=0.056, 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 D_K_CEMDVsYW for ; Tue, 19 Sep 2017 13:39:56 -0700 (PDT) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by arlo.cworth.org (Postfix) with ESMTPS id 40D7C6DE0FE6 for ; Tue, 19 Sep 2017 13:39:51 -0700 (PDT) Received: by mail-lf0-f49.google.com with SMTP id b127so780911lfe.9 for ; Tue, 19 Sep 2017 13:39:51 -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=he5L2j/kK9KLRf0w41hPwN90ls65B46m2WoGZxi/OlU=; b=LXwXo4yrZLusELNBKxOWl5w7Qm+7uE9LJLmMhB5hCLYuikpgAXrClQwgYFReIMhTgQ yxkYyh2BjSwrkWAshK+tdD2Yf0N2RI4wEUuj9FV9dCEUm+bdvPS37NOlOmcYHYgY8ROU 5sP5war53QIYhN8Ed5n6qIqpIOW6ZejaakS5f4KX0Fhrpkl7H+n7kxwv/rMgQMVCdUBW IH6DtVsAwW5lVTgfcw/qaAhbzTV+53IeQdRE7LUtSVFddeVfpFoc2ipXMsWt5CZ1JZhu VmwfNQzlLwCWhoE5eqqcfwdG6Evxcw1jjDF8Tfwty2KKIHQTv3/Yoj4HBJkgb7CQxr7+ Bw2g== 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=he5L2j/kK9KLRf0w41hPwN90ls65B46m2WoGZxi/OlU=; b=jVgG5k/GQCmGdkMIxGW/hrvby5rqnhjqIVkwYijsyYv5Q9Sy7Yzs3cC7jaGHIG1pvB 6nlm+6ASTExXeodDDe/rASsGtrhtlwNyKcNE1hLjbIkrp9m0op0RGsUe0mWlwyufsCHg FLJ5xZfBe0xnVEbezaoo5q/l8JkzByhUTlMtCJeHRQTBGNvfNT+ylO6G8PT6E0hZkgUp s+StsREK7j8D9sAYvQsB9XSKZ648xrCpQSFs9AuHKzcw2hopGz+pmo0A79+CkvM4imD3 eD6r3xmxXI5D5wIzn3qL1Sxmx7G4QsQrMa+ay8bHmYayAUzc+L1PXbgSUlSF4PIsxw7P ZbEQ== X-Gm-Message-State: AHPjjUj9pAT7tJgAdPSpmn0FhE9KTN6L/a6C3vivzIynF+Wo5NjAqt9g iBblNHuFXm4xLpjRvi2uMjvm4kN50Qw= X-Google-Smtp-Source: AOwi7QCSIE+46uvlDxENNZD9SGG6cZ2WeWUhBydXw/KWGivK25OpNcCFJZGCbCoVSXtbdadc+g9kRQ== X-Received: by 10.46.86.220 with SMTP id k89mr1375807lje.103.1505853588935; Tue, 19 Sep 2017 13:39:48 -0700 (PDT) Received: from localhost (mobile-access-5d6a60-234.dhcp.inet.fi. [93.106.96.234]) by smtp.gmail.com with ESMTPSA id v64sm48421lje.39.2017.09.19.13.39.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Sep 2017 13:39:48 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 8/9] test: add boolean argument to arg-test Date: Tue, 19 Sep 2017 23:39:28 +0300 Message-Id: <18b244570331278f0064b41a1e4f1b713781e7e2.1505853159.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: Tue, 19 Sep 2017 20:39:57 -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 736686ded2c0..2f839c992c56 100644 --- a/test/arg-test.c +++ b/test/arg-test.c @@ -12,8 +12,10 @@ int main(int argc, char **argv){ char *pos_arg1=NULL; char *pos_arg2=NULL; char *string_val=NULL; + notmuch_bool_t bool_val = FALSE; notmuch_opt_desc_t options[] = { + { NOTMUCH_OPT_BOOLEAN, &bool_val, "boolean", 'b', 0}, { NOTMUCH_OPT_KEYWORD, &kw_val, "keyword", 'k', (notmuch_keyword_t []){ { "one", 1 }, { "two", 2 }, @@ -34,6 +36,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