mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 12:13:52 +00:00
tests: add a few more coverage tests (#794)
* add a few more coverage tests * style: pre-commit.ci fixes * try to fix pre-commit issues * update mdlint style as a test * style: pre-commit.ci fixes * fix test * switch test to not generate warning * add a few more tests * tweak the conanfile and appveyor to debug issue * update tests Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
90e6ee1aaa
commit
4dbe4b4ec4
@ -24,6 +24,7 @@ build_script:
|
||||
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_GENERATOR="Visual Studio 14 2015"
|
||||
- ps: cmake --build .
|
||||
- cd ..
|
||||
- ps: set CTEST_OUTPUT_ON_FAILURE=1
|
||||
- conan create . CLIUtils/CLI11
|
||||
|
||||
test_script:
|
||||
|
@ -37,7 +37,7 @@ class CLI11Conan(ConanFile):
|
||||
|
||||
def build(self): # this is not building a library, just tests
|
||||
cmake = CMake(self)
|
||||
cmake.definitions["CLI11_EXAMPLES"] = "OFF"
|
||||
cmake.definitions["CLI11_BUILD_EXAMPLES"] = "OFF"
|
||||
cmake.definitions["CLI11_SINGLE_FILE"] = "OFF"
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
@ -61,7 +61,7 @@ class Config {
|
||||
if(item.inputs.empty()) {
|
||||
return "{}";
|
||||
}
|
||||
throw ConversionError::TooManyInputsFlag(item.fullname());
|
||||
throw ConversionError::TooManyInputsFlag(item.fullname()); // LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
/// Parse a config file, throw an error (ParseError:ConfigParseError or FileError) on failure
|
||||
|
@ -132,7 +132,7 @@ CLI11_INLINE path_type check_path(const char *file) noexcept {
|
||||
return path_type::nonexistent;
|
||||
}
|
||||
switch(stat.type()) {
|
||||
case std::filesystem::file_type::none:
|
||||
case std::filesystem::file_type::none: // LCOV_EXCL_LINE
|
||||
case std::filesystem::file_type::not_found:
|
||||
return path_type::nonexistent;
|
||||
case std::filesystem::file_type::directory:
|
||||
|
@ -6,3 +6,4 @@ exclude_rule 'MD034' # Bare URL (for now)
|
||||
|
||||
rule 'MD026', punctuation: '.,;:!' # Trailing punctuation in header (& in this case)
|
||||
rule 'MD029', style: :ordered
|
||||
rule 'MD007', indent: 2
|
||||
|
@ -525,6 +525,10 @@ TEST_CASE("Validators: ProgramNameSplit", "[helpers]") {
|
||||
res = CLI::detail::split_program_name(std::string(" ./") + std::string(myfile) + " ");
|
||||
CHECK(std::string("./") + std::string(myfile) == res.first);
|
||||
CHECK(res.second.empty());
|
||||
|
||||
res = CLI::detail::split_program_name("'odd_program_name.exe --arg --arg2=5");
|
||||
CHECK("'odd_program_name.exe" == res.first);
|
||||
CHECK_FALSE(res.second.empty());
|
||||
}
|
||||
|
||||
TEST_CASE("CheckedMultiply: Int", "[helpers]") {
|
||||
@ -1065,6 +1069,10 @@ TEST_CASE("Types: LexicalCastInt", "[helpers]") {
|
||||
std::string extra_input = "912i";
|
||||
CHECK_FALSE(CLI::detail::lexical_cast(extra_input, y));
|
||||
|
||||
extra_input = "true";
|
||||
CHECK(CLI::detail::lexical_cast(extra_input, x_signed));
|
||||
CHECK(x_signed != 0);
|
||||
|
||||
std::string empty_input{};
|
||||
CHECK_FALSE(CLI::detail::lexical_cast(empty_input, x_signed));
|
||||
CHECK_FALSE(CLI::detail::lexical_cast(empty_input, x_unsigned));
|
||||
|
Loading…
x
Reference in New Issue
Block a user