[PATCH v2 04/15] test: add opt_inherit to arg-test

Jani Nikula jani at nikula.org
Sun Oct 1 13:53:13 PDT 2017


Just split the arguments to two opt desc arrays.
---
 test/arg-test.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/test/arg-test.c b/test/arg-test.c
index 9d13618bd17c..a379f23e308a 100644
--- a/test/arg-test.c
+++ b/test/arg-test.c
@@ -14,18 +14,23 @@ int main(int argc, char **argv){
     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 },
-				  { 0, 0 } } },
+    notmuch_opt_desc_t parent_options[] = {
 	{ .opt_flags = &fl_val, .name = "flag", .keywords =
 	  (notmuch_keyword_t []){ { "one",   1 << 0},
 				  { "two",   1 << 1 },
 				  { "three", 1 << 2 },
 				  { 0, 0 } } },
 	{ .opt_int = &int_val, .name = "int" },
+	{ }
+    };
+
+    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 },
+				  { 0, 0 } } },
+	{ .opt_inherit = parent_options },
 	{ .opt_string = &string_val, .name = "string" },
 	{ .opt_position = &pos_arg1 },
 	{ .opt_position = &pos_arg2 },
-- 
2.11.0



More information about the notmuch mailing list