@@ -21,6 +21,7 @@ struct test_argument_parser_add_argument : public argument_parser_test_fixture {
21
21
const std::string_view secondary_name_2 = " s2" ;
22
22
23
23
const std::string_view invalid_name_empty = " " ;
24
+ const std::string_view invalid_name_whitespace = " invalid name" ;
24
25
const std::string_view invalid_name_flag_prefix = " -invalid" ;
25
26
const std::string_view invalid_name_digit = " 1invalid" ;
26
27
};
@@ -37,6 +38,11 @@ TEST_CASE_FIXTURE(
37
38
reason = " An argument name cannot be empty." ;
38
39
}
39
40
41
+ SUBCASE (" The name contains whitespace characters" ) {
42
+ primary_name = invalid_name_whitespace;
43
+ reason = " An argument name cannot contain whitespaces." ;
44
+ }
45
+
40
46
SUBCASE (" The name begins with the flag prefix character" ) {
41
47
primary_name = invalid_name_flag_prefix;
42
48
reason = " An argument name cannot begin with a flag prefix character (-)." ;
@@ -75,6 +81,11 @@ TEST_CASE_FIXTURE(
75
81
reason = " An argument name cannot be empty." ;
76
82
}
77
83
84
+ SUBCASE (" The name contains whitespace characters" ) {
85
+ primary_name = invalid_name_whitespace;
86
+ reason = " An argument name cannot contain whitespaces." ;
87
+ }
88
+
78
89
SUBCASE (" The name begins with the flag prefix character" ) {
79
90
primary_name = invalid_name_flag_prefix;
80
91
reason = " An argument name cannot begin with a flag prefix character (-)." ;
@@ -113,6 +124,11 @@ TEST_CASE_FIXTURE(
113
124
reason = " An argument name cannot be empty." ;
114
125
}
115
126
127
+ SUBCASE (" The name contains whitespace characters" ) {
128
+ secondary_name = invalid_name_whitespace;
129
+ reason = " An argument name cannot contain whitespaces." ;
130
+ }
131
+
116
132
SUBCASE (" The name begins with the flag prefix character" ) {
117
133
secondary_name = invalid_name_flag_prefix;
118
134
reason = " An argument name cannot begin with a flag prefix character (-)." ;
@@ -141,8 +157,7 @@ TEST_CASE_FIXTURE(
141
157
142
158
TEST_CASE_FIXTURE (
143
159
test_argument_parser_add_argument,
144
- " add_positional_argument should throw only when adding an"
145
- " argument with a previously used name"
160
+ " add_positional_argument should throw when adding an argument with a previously used name"
146
161
) {
147
162
sut.add_positional_argument (primary_name_1, secondary_name_1);
148
163
@@ -169,8 +184,7 @@ TEST_CASE_FIXTURE(
169
184
170
185
TEST_CASE_FIXTURE (
171
186
test_argument_parser_add_argument,
172
- " add_optional_argument should throw only when adding an"
173
- " argument with a previously used name"
187
+ " add_optional_argument should throw when adding an argument with a previously used name"
174
188
) {
175
189
sut.add_optional_argument (primary_name_1, secondary_name_1);
176
190
@@ -226,7 +240,7 @@ TEST_CASE_FIXTURE(
226
240
227
241
TEST_CASE_FIXTURE (
228
242
test_argument_parser_add_argument,
229
- " add_flag should throw only when adding and argument with a previously used name"
243
+ " add_flag should throw when adding and argument with a previously used name"
230
244
) {
231
245
sut.add_flag (primary_name_1, secondary_name_1);
232
246
0 commit comments