From 40fed88f8e0210815175dd01e9e50a98682d5754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 15 May 2026 21:29:37 +0200 Subject: [PATCH] test-verbs: dispatch via _dispatch_verb_with_args() directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drops the global-optind dependency from the test helper. Verb fixtures stay inline as static const Verb[] — the section-based VERB() macro would force unique verb names across the three test cases, which they deliberately share to exercise overlap. Co-developed-by: Claude Opus 4.7 (1M context) --- src/test/test-verbs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/test/test-verbs.c b/src/test/test-verbs.c index 41ae5a87f3..cfff6ec728 100644 --- a/src/test/test-verbs.c +++ b/src/test/test-verbs.c @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include - #include "strv.h" #include "tests.h" #include "verbs.h" @@ -11,8 +9,7 @@ static int noop_dispatcher(int argc, char *argv[], uintptr_t _data, void *userda } #define test_dispatch_one(argv, verbs, expected) \ - optind = 0; \ - assert_se(dispatch_verb(strv_length(argv), argv, verbs, NULL) == expected); + assert_se(_dispatch_verb_with_args(argv, verbs, verbs + ELEMENTSOF(verbs) - 1, NULL) == expected); TEST(verbs) { static const Verb verbs[] = {