-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MISC] Add new output_file_validator ctors #71
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/seqan/sharg-parser/ZGyekBpXQd5Fwwz61GZk8xrRZwkE |
Codecov Report
@@ Coverage Diff @@
## master #71 +/- ##
==========================================
+ Coverage 94.63% 94.67% +0.04%
==========================================
Files 14 14
Lines 1194 1203 +9
==========================================
+ Hits 1130 1139 +9
Misses 64 64
Continue to review full report at Codecov.
|
7776b34
to
c45770a
Compare
include/sharg/validators.hpp
Outdated
* \param[in] mode A sharg::output_file_open_options indicating whether the validator throws if a file already | ||
* exists. | ||
* \param[in] extensions Parameter pack representing valid extensions. std::string must be constructible from each | ||
* parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* parameter. | |
* argument. The pack may be empty ( → all extensions are valid). |
c45770a
to
77e32dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just a missing test case I think
/*!\brief Constructs from a list of valid extensions. | ||
* \param[in] extensions The valid extensions to validate for. | ||
*/ | ||
explicit output_file_validator(std::vector<std::string> const & extensions) | ||
: output_file_validator{output_file_open_options::create_new, extensions} | ||
{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I use this constructor and an empty list, are all extensions valid then? (should be, just wondering about the implementation because I think a test case is missing?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same, because we do file_validator_base::extensions = std::move(extensions);
and file_validator_base::extensions
is empty by default.
I added explicit tests :)
77e32dc
to
1721e5a
Compare
1721e5a
to
3865241
Compare
Open:
static_assert
) for construction the vector from the parameter pack:requires
as it's important for overload resultion.