Skip to content

Commit 6be7c54

Browse files
committed
tests: rename result value to result
The out-param of the parser is not necessarily the invalid argument; it may be empty. Use the name `result` instead.
1 parent dabeb42 commit 6be7c54

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

tests/adopt.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void test_adopt__long_switches2(void)
168168
{ &specs[0], NULL },
169169
{ &specs[1], NULL }
170170
};
171-
171+
172172
/* Parse --foo --bar */
173173
test_parse(specs, args2, 2, expected2, 2);
174174
cl_assert_equal_i('f', foo);
@@ -193,7 +193,7 @@ void test_adopt__long_switches3(void)
193193
{ &specs[1], NULL },
194194
{ NULL, "-u" },
195195
};
196-
196+
197197
/* Parse --foo bare2 --bar -u */
198198
test_parse(specs, args3, 4, expected3, 4);
199199
cl_assert_equal_i('f', foo);
@@ -209,7 +209,7 @@ void test_adopt__long_values1(void)
209209
{ ADOPT_VALUE_OPTIONAL, "bar", 0, &bar, 0 },
210210
{ 0 }
211211
};
212-
212+
213213
char *args1[] = { "--foo", "arg_1" };
214214
adopt_expected expected1[] = {
215215
{ &specs[0], "arg_1" },
@@ -230,7 +230,7 @@ void test_adopt__long_values2(void)
230230
{ ADOPT_VALUE_OPTIONAL, "bar", 0, &bar, 0 },
231231
{ 0 }
232232
};
233-
233+
234234
char *args2[] = { "--foo", "--bar" };
235235
adopt_expected expected2[] = {
236236
{ &specs[0], "--bar" },
@@ -251,7 +251,7 @@ void test_adopt__long_values3(void)
251251
{ ADOPT_VALUE_OPTIONAL, "bar", 0, &bar, 0 },
252252
{ 0 }
253253
};
254-
254+
255255
char *args3[] = { "--foo", "--arg_1", "--bar", "arg_2" };
256256
adopt_expected expected3[] = {
257257
{ &specs[0], "--arg_1" },
@@ -273,7 +273,7 @@ void test_adopt__long_values4(void)
273273
{ ADOPT_VALUE_OPTIONAL, "bar", 0, &bar, 0 },
274274
{ 0 }
275275
};
276-
276+
277277
char *args4[] = { "--foo=bar" };
278278
adopt_expected expected4[] = {
279279
{ &specs[0], "bar" },
@@ -333,7 +333,7 @@ void test_adopt__short_switches2(void)
333333
{ ADOPT_SWITCH, "bar", 'b', &bar, 'b' },
334334
{ 0 }
335335
};
336-
336+
337337
char *args2[] = { "-f", "-b" };
338338
adopt_expected expected2[] = {
339339
{ &specs[0], NULL },
@@ -379,7 +379,7 @@ void test_adopt__short_values1(void)
379379
{ ADOPT_VALUE_OPTIONAL, "bar", 'b', &bar, 0 },
380380
{ 0 }
381381
};
382-
382+
383383
char *args1[] = { "-f", "arg_1" };
384384
adopt_expected expected1[] = {
385385
{ &specs[0], "arg_1" },
@@ -400,7 +400,7 @@ void test_adopt__short_values2(void)
400400
{ ADOPT_VALUE_OPTIONAL, "bar", 'b', &bar, 0 },
401401
{ 0 }
402402
};
403-
403+
404404
char *args2[] = { "-f", "--bar" };
405405
adopt_expected expected2[] = {
406406
{ &specs[0], "--bar" },
@@ -525,7 +525,7 @@ void test_adopt__no_long_argument(void)
525525
void test_adopt__parse_oneshot(void)
526526
{
527527
int foo = 0, bar = 0;
528-
adopt_opt invalid;
528+
adopt_opt result;
529529

530530
adopt_spec specs[] = {
531531
{ ADOPT_SWITCH, NULL, 'f', &foo, 'f' },
@@ -535,20 +535,20 @@ void test_adopt__parse_oneshot(void)
535535

536536
char *args[] = { "-f", "--bar" };
537537

538-
cl_must_pass(adopt_parse(&invalid, specs, args, 2));
538+
cl_must_pass(adopt_parse(&result, specs, args, 2));
539539

540540
cl_assert_equal_i('f', foo);
541541
cl_assert_equal_i('b', bar);
542542

543-
cl_assert_equal_i(ADOPT_STATUS_DONE, invalid.status);
544-
cl_assert_equal_p(NULL, invalid.arg);
545-
cl_assert_equal_p(NULL, invalid.value);
543+
cl_assert_equal_i(ADOPT_STATUS_DONE, result.status);
544+
cl_assert_equal_p(NULL, result.arg);
545+
cl_assert_equal_p(NULL, result.value);
546546
}
547547

548548
void test_adopt__parse_oneshot_unknown_option(void)
549549
{
550550
int foo = 0, bar = 0;
551-
adopt_opt invalid;
551+
adopt_opt result;
552552

553553
adopt_spec specs[] = {
554554
{ ADOPT_SWITCH, NULL, 'f', &foo, 'f' },
@@ -558,14 +558,14 @@ void test_adopt__parse_oneshot_unknown_option(void)
558558

559559
char *args[] = { "-f", "--bar", "--asdf" };
560560

561-
cl_assert_equal_i(ADOPT_STATUS_UNKNOWN_OPTION, adopt_parse(&invalid, specs, args, 3));
561+
cl_assert_equal_i(ADOPT_STATUS_UNKNOWN_OPTION, adopt_parse(&result, specs, args, 3));
562562
}
563563

564564
void test_adopt__parse_oneshot_missing_value(void)
565565
{
566566
int foo = 0;
567567
char *bar = NULL;
568-
adopt_opt invalid;
568+
adopt_opt result;
569569

570570
adopt_spec specs[] = {
571571
{ ADOPT_SWITCH, NULL, 'f', &foo, 'f' },
@@ -575,5 +575,5 @@ void test_adopt__parse_oneshot_missing_value(void)
575575

576576
char *args[] = { "-f", "--bar" };
577577

578-
cl_assert_equal_i(ADOPT_STATUS_MISSING_VALUE, adopt_parse(&invalid, specs, args, 2));
578+
cl_assert_equal_i(ADOPT_STATUS_MISSING_VALUE, adopt_parse(&result, specs, args, 2));
579579
}

0 commit comments

Comments
 (0)