@@ -168,7 +168,7 @@ void test_adopt__long_switches2(void)
168
168
{ & specs [0 ], NULL },
169
169
{ & specs [1 ], NULL }
170
170
};
171
-
171
+
172
172
/* Parse --foo --bar */
173
173
test_parse (specs , args2 , 2 , expected2 , 2 );
174
174
cl_assert_equal_i ('f' , foo );
@@ -193,7 +193,7 @@ void test_adopt__long_switches3(void)
193
193
{ & specs [1 ], NULL },
194
194
{ NULL , "-u" },
195
195
};
196
-
196
+
197
197
/* Parse --foo bare2 --bar -u */
198
198
test_parse (specs , args3 , 4 , expected3 , 4 );
199
199
cl_assert_equal_i ('f' , foo );
@@ -209,7 +209,7 @@ void test_adopt__long_values1(void)
209
209
{ ADOPT_VALUE_OPTIONAL , "bar" , 0 , & bar , 0 },
210
210
{ 0 }
211
211
};
212
-
212
+
213
213
char * args1 [] = { "--foo" , "arg_1" };
214
214
adopt_expected expected1 [] = {
215
215
{ & specs [0 ], "arg_1" },
@@ -230,7 +230,7 @@ void test_adopt__long_values2(void)
230
230
{ ADOPT_VALUE_OPTIONAL , "bar" , 0 , & bar , 0 },
231
231
{ 0 }
232
232
};
233
-
233
+
234
234
char * args2 [] = { "--foo" , "--bar" };
235
235
adopt_expected expected2 [] = {
236
236
{ & specs [0 ], "--bar" },
@@ -251,7 +251,7 @@ void test_adopt__long_values3(void)
251
251
{ ADOPT_VALUE_OPTIONAL , "bar" , 0 , & bar , 0 },
252
252
{ 0 }
253
253
};
254
-
254
+
255
255
char * args3 [] = { "--foo" , "--arg_1" , "--bar" , "arg_2" };
256
256
adopt_expected expected3 [] = {
257
257
{ & specs [0 ], "--arg_1" },
@@ -273,7 +273,7 @@ void test_adopt__long_values4(void)
273
273
{ ADOPT_VALUE_OPTIONAL , "bar" , 0 , & bar , 0 },
274
274
{ 0 }
275
275
};
276
-
276
+
277
277
char * args4 [] = { "--foo=bar" };
278
278
adopt_expected expected4 [] = {
279
279
{ & specs [0 ], "bar" },
@@ -333,7 +333,7 @@ void test_adopt__short_switches2(void)
333
333
{ ADOPT_SWITCH , "bar" , 'b' , & bar , 'b' },
334
334
{ 0 }
335
335
};
336
-
336
+
337
337
char * args2 [] = { "-f" , "-b" };
338
338
adopt_expected expected2 [] = {
339
339
{ & specs [0 ], NULL },
@@ -379,7 +379,7 @@ void test_adopt__short_values1(void)
379
379
{ ADOPT_VALUE_OPTIONAL , "bar" , 'b' , & bar , 0 },
380
380
{ 0 }
381
381
};
382
-
382
+
383
383
char * args1 [] = { "-f" , "arg_1" };
384
384
adopt_expected expected1 [] = {
385
385
{ & specs [0 ], "arg_1" },
@@ -400,7 +400,7 @@ void test_adopt__short_values2(void)
400
400
{ ADOPT_VALUE_OPTIONAL , "bar" , 'b' , & bar , 0 },
401
401
{ 0 }
402
402
};
403
-
403
+
404
404
char * args2 [] = { "-f" , "--bar" };
405
405
adopt_expected expected2 [] = {
406
406
{ & specs [0 ], "--bar" },
@@ -525,7 +525,7 @@ void test_adopt__no_long_argument(void)
525
525
void test_adopt__parse_oneshot (void )
526
526
{
527
527
int foo = 0 , bar = 0 ;
528
- adopt_opt invalid ;
528
+ adopt_opt result ;
529
529
530
530
adopt_spec specs [] = {
531
531
{ ADOPT_SWITCH , NULL , 'f' , & foo , 'f' },
@@ -535,20 +535,20 @@ void test_adopt__parse_oneshot(void)
535
535
536
536
char * args [] = { "-f" , "--bar" };
537
537
538
- cl_must_pass (adopt_parse (& invalid , specs , args , 2 ));
538
+ cl_must_pass (adopt_parse (& result , specs , args , 2 ));
539
539
540
540
cl_assert_equal_i ('f' , foo );
541
541
cl_assert_equal_i ('b' , bar );
542
542
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 );
546
546
}
547
547
548
548
void test_adopt__parse_oneshot_unknown_option (void )
549
549
{
550
550
int foo = 0 , bar = 0 ;
551
- adopt_opt invalid ;
551
+ adopt_opt result ;
552
552
553
553
adopt_spec specs [] = {
554
554
{ ADOPT_SWITCH , NULL , 'f' , & foo , 'f' },
@@ -558,14 +558,14 @@ void test_adopt__parse_oneshot_unknown_option(void)
558
558
559
559
char * args [] = { "-f" , "--bar" , "--asdf" };
560
560
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 ));
562
562
}
563
563
564
564
void test_adopt__parse_oneshot_missing_value (void )
565
565
{
566
566
int foo = 0 ;
567
567
char * bar = NULL ;
568
- adopt_opt invalid ;
568
+ adopt_opt result ;
569
569
570
570
adopt_spec specs [] = {
571
571
{ ADOPT_SWITCH , NULL , 'f' , & foo , 'f' },
@@ -575,5 +575,5 @@ void test_adopt__parse_oneshot_missing_value(void)
575
575
576
576
char * args [] = { "-f" , "--bar" };
577
577
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 ));
579
579
}
0 commit comments