Skip to content

Commit 6d43870

Browse files
committed
test-argparse.cpp: added check for single arg
1 parent f2856d2 commit 6d43870

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/test-argparse.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ TEST_CASE("argparse") {
1616
"-pTEST", // mask 0x0008, counted in nargs, value checked
1717
"--apple=test", // mask 0x0010, counted in nargs, value checked
1818
"--equal==test", // mask 0x2000, counted in nargs, value checked
19+
"-cx", // mask 0x8000, counted in nargs
1920
"--bigword", // mask 0x0200, counted in nbig
2021
"--long", "999", // mask 0x0020, counted in nargs, value checked
2122
"firstfile", // mask 0x0080, counted in nfiles, value checked
@@ -50,6 +51,12 @@ TEST_CASE("argparse") {
5051
argmask |= 0x0002;
5152
nargs ++;
5253
break;
54+
case 'c':
55+
CHECK( strcmp(arg.getstr(), "x") == 0 );
56+
argmask |= 0x8000;
57+
nargs ++;
58+
break;
59+
5360
case 'p':
5461
if (arg.match("-pear")) {
5562
CHECK( arg.getint() == 0x1234 );
@@ -139,9 +146,9 @@ TEST_CASE("argparse") {
139146
CHECK( nrends == 1 );
140147
CHECK( nfiles == 2 );
141148
CHECK( nextra == 3 );
142-
CHECK( nargs == 9 );
149+
CHECK( nargs == 10 );
143150
CHECK( nbig == 2 );
144-
CHECK( argmask == 0x7FFF );
151+
CHECK( argmask == 0xFFFF );
145152
}
146153
SECTION("testerrors") {
147154
const char*argv[] = {

0 commit comments

Comments
 (0)