Fix OptionParser test on Windows.
This commit is contained in:
parent
57de0c4967
commit
6ae33a5c27
@ -91,6 +91,10 @@ Result<vector<char *>> OptionParser::run(int argc, char *argv[], int expected_no
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return run_impl(argc, argv, expected_non_option_count);
|
||||
}
|
||||
|
||||
Result<vector<char *>> OptionParser::run_impl(int argc, char *argv[], int expected_non_option_count) {
|
||||
std::unordered_map<char, const Option *> short_options;
|
||||
std::unordered_map<string, const Option *> long_options;
|
||||
for (auto &opt : options_) {
|
||||
|
@ -66,6 +66,9 @@ class OptionParser {
|
||||
// returns found non-option parameters
|
||||
Result<vector<char *>> run(int argc, char *argv[], int expected_non_option_count = -1) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
// for testing only
|
||||
Result<vector<char *>> run_impl(int argc, char *argv[], int expected_non_option_count) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
friend StringBuilder &operator<<(StringBuilder &sb, const OptionParser &o);
|
||||
|
||||
private:
|
||||
|
@ -23,7 +23,7 @@ TEST(OptionParser, run) {
|
||||
for (auto &arg : args) {
|
||||
argv.push_back(&arg[0]);
|
||||
}
|
||||
return options.run(static_cast<int>(argv.size()), &argv[0]);
|
||||
return options.run_impl(static_cast<int>(argv.size()), &argv[0], -1);
|
||||
};
|
||||
|
||||
td::uint64 chosen_options = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user