@@ -63,8 +63,7 @@ struct test_case {
63
63
The "boost::program_options" in parameter type is needed because CW9
64
64
has std::detail and it causes an ambiguity.
65
65
*/
66
- void apply_syntax (options_description& desc,
67
- positional_options_description & m_positional,
66
+ void apply_syntax (options_description& desc,
68
67
const char * syntax)
69
68
{
70
69
@@ -78,8 +77,8 @@ void apply_syntax(options_description& desc,
78
77
v = value<string>();
79
78
s.resize (s.size ()-1 );
80
79
} else if (*(s.end ()-1 ) == ' ?' ) {
81
- v = value<string>()->implicit_value ( " bar " );
82
- m_positional. add ( " positional " , - 1 );
80
+ // v = value<string>()->implicit( );
81
+ v = value<string>( );
83
82
s.resize (s.size ()-1 );
84
83
} else if (*(s.end ()-1 ) == ' *' ) {
85
84
v = value<vector<string> >()->multitoken ();
@@ -114,14 +113,12 @@ void test_cmdline(const char* syntax,
114
113
}
115
114
}
116
115
options_description desc;
117
- positional_options_description m_positional;
118
- apply_syntax (desc, m_positional, syntax);
116
+ apply_syntax (desc, syntax);
119
117
120
118
cmdline cmd (xinput);
121
119
cmd.style (style);
122
120
cmd.set_options_description (desc);
123
- if (m_positional.max_total_count ())
124
- cmd.set_positional_options (m_positional);
121
+
125
122
126
123
string result;
127
124
int status = 0 ;
@@ -133,9 +130,7 @@ void test_cmdline(const char* syntax,
133
130
{
134
131
option opt = options[j];
135
132
136
- if (opt.position_key != -1
137
- && (m_positional.max_total_count () == 0 || (size_t )opt.position_key >= m_positional.max_total_count ()
138
- || m_positional.name_for_position (opt.position_key ) != " positional" )) {
133
+ if (opt.position_key != -1 ) {
139
134
if (!result.empty ())
140
135
result += " " ;
141
136
result += opt.value [0 ];
@@ -233,7 +228,7 @@ void test_long_options()
233
228
{" --giz" , s_success, " Giz:" },
234
229
{0 , 0 , 0 }
235
230
};
236
- test_cmdline (" foo bar= Giz" , style, test_cases4);
231
+ test_cmdline (" foo bar= baz? Giz" , style, test_cases4);
237
232
}
238
233
239
234
void test_short_options ()
@@ -353,15 +348,15 @@ void test_disguised_long()
353
348
{" -bee=x -by" , s_success, " bee:x bee:y" },
354
349
{0 , 0 , 0 }
355
350
};
356
- test_cmdline (" foo,f goo,g= bee,b= " , style, test_cases1);
351
+ test_cmdline (" foo,f goo,g= bee,b? " , style, test_cases1);
357
352
358
353
style = cmdline::style_t (style | allow_slash_for_short);
359
354
test_case test_cases2[] = {
360
355
{" /foo -f" , s_success, " foo: foo:" },
361
356
{" /goo=x" , s_success, " goo:x" },
362
357
{0 , 0 , 0 }
363
358
};
364
- test_cmdline (" foo,f goo,g=" , style, test_cases2);
359
+ test_cmdline (" foo,f goo,g= bee,b? " , style, test_cases2);
365
360
}
366
361
367
362
void test_guessing ()
@@ -612,35 +607,6 @@ void test_unregistered()
612
607
// It's not clear yet, so I'm leaving the decision till later.
613
608
}
614
609
615
- void test_implicit_value ()
616
- {
617
- using namespace command_line_style ;
618
- cmdline::style_t style;
619
-
620
- style = cmdline::style_t (
621
- allow_long | long_allow_adjacent
622
- );
623
-
624
- test_case test_cases1[] = {
625
- {" --foo bar" , s_success, " foo: positional:bar" },
626
- {" --foo=bar foobar" , s_success, " foo:bar positional:foobar" },
627
- {0 , 0 , 0 }
628
- };
629
-
630
- test_cmdline (" positional= foo?" , style, test_cases1);
631
-
632
- style = cmdline::style_t (
633
- allow_short | allow_dash_for_short
634
- | short_allow_adjacent);
635
-
636
- test_case test_cases2[] = {
637
- {" -f bar" , s_success, " -f: positional:bar" },
638
- {" -fbar foobar" , s_success, " -f:bar positional:foobar" },
639
- {0 , 0 , 0 }
640
- };
641
- test_cmdline (" positional= ,f?" , style, test_cases2);
642
- }
643
-
644
610
int main (int /* ac*/ , char ** /* av*/ )
645
611
{
646
612
test_long_options ();
@@ -653,7 +619,6 @@ int main(int /*ac*/, char** /*av*/)
653
619
test_additional_parser ();
654
620
test_style_parser ();
655
621
test_unregistered ();
656
- test_implicit_value ();
657
622
658
623
return 0 ;
659
624
}
0 commit comments