]> git.notmuchmail.org Git - notmuch/commitdiff
test: add opt_inherit to arg-test
authorJani Nikula <jani@nikula.org>
Sun, 1 Oct 2017 20:53:13 +0000 (23:53 +0300)
committerDavid Bremner <david@tethera.net>
Thu, 5 Oct 2017 01:01:15 +0000 (22:01 -0300)
Just split the arguments to two opt desc arrays.

test/arg-test.c

index 9d13618bd17c004e8dfbc822b08a5ef587a0d56d..a379f23e308a8b349efc5fc4a664ae3ea4e870a7 100644 (file)
@@ -14,18 +14,23 @@ int main(int argc, char **argv){
     const char *string_val=NULL;
     notmuch_bool_t bool_val = FALSE;
 
     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" },
        { .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 },
        { .opt_string = &string_val, .name = "string" },
        { .opt_position = &pos_arg1 },
        { .opt_position = &pos_arg2 },