Commit 4dbe4b4ec46c29bbc53067b2c695af2753196c81
Committed by
GitHub
1 parent
90e6ee1a
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>
Showing
6 changed files
with
13 additions
and
3 deletions
.appveyor.yml
conanfile.py
| ... | ... | @@ -37,7 +37,7 @@ class CLI11Conan(ConanFile): |
| 37 | 37 | |
| 38 | 38 | def build(self): # this is not building a library, just tests |
| 39 | 39 | cmake = CMake(self) |
| 40 | - cmake.definitions["CLI11_EXAMPLES"] = "OFF" | |
| 40 | + cmake.definitions["CLI11_BUILD_EXAMPLES"] = "OFF" | |
| 41 | 41 | cmake.definitions["CLI11_SINGLE_FILE"] = "OFF" |
| 42 | 42 | cmake.configure() |
| 43 | 43 | cmake.build() | ... | ... |
include/CLI/ConfigFwd.hpp
| ... | ... | @@ -61,7 +61,7 @@ class Config { |
| 61 | 61 | if(item.inputs.empty()) { |
| 62 | 62 | return "{}"; |
| 63 | 63 | } |
| 64 | - throw ConversionError::TooManyInputsFlag(item.fullname()); | |
| 64 | + throw ConversionError::TooManyInputsFlag(item.fullname()); // LCOV_EXCL_LINE | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /// Parse a config file, throw an error (ParseError:ConfigParseError or FileError) on failure | ... | ... |
include/CLI/impl/Validators_inl.hpp
| ... | ... | @@ -132,7 +132,7 @@ CLI11_INLINE path_type check_path(const char *file) noexcept { |
| 132 | 132 | return path_type::nonexistent; |
| 133 | 133 | } |
| 134 | 134 | switch(stat.type()) { |
| 135 | - case std::filesystem::file_type::none: | |
| 135 | + case std::filesystem::file_type::none: // LCOV_EXCL_LINE | |
| 136 | 136 | case std::filesystem::file_type::not_found: |
| 137 | 137 | return path_type::nonexistent; |
| 138 | 138 | case std::filesystem::file_type::directory: | ... | ... |
scripts/mdlint_style.rb
tests/HelpersTest.cpp
| ... | ... | @@ -525,6 +525,10 @@ TEST_CASE("Validators: ProgramNameSplit", "[helpers]") { |
| 525 | 525 | res = CLI::detail::split_program_name(std::string(" ./") + std::string(myfile) + " "); |
| 526 | 526 | CHECK(std::string("./") + std::string(myfile) == res.first); |
| 527 | 527 | CHECK(res.second.empty()); |
| 528 | + | |
| 529 | + res = CLI::detail::split_program_name("'odd_program_name.exe --arg --arg2=5"); | |
| 530 | + CHECK("'odd_program_name.exe" == res.first); | |
| 531 | + CHECK_FALSE(res.second.empty()); | |
| 528 | 532 | } |
| 529 | 533 | |
| 530 | 534 | TEST_CASE("CheckedMultiply: Int", "[helpers]") { |
| ... | ... | @@ -1065,6 +1069,10 @@ TEST_CASE("Types: LexicalCastInt", "[helpers]") { |
| 1065 | 1069 | std::string extra_input = "912i"; |
| 1066 | 1070 | CHECK_FALSE(CLI::detail::lexical_cast(extra_input, y)); |
| 1067 | 1071 | |
| 1072 | + extra_input = "true"; | |
| 1073 | + CHECK(CLI::detail::lexical_cast(extra_input, x_signed)); | |
| 1074 | + CHECK(x_signed != 0); | |
| 1075 | + | |
| 1068 | 1076 | std::string empty_input{}; |
| 1069 | 1077 | CHECK_FALSE(CLI::detail::lexical_cast(empty_input, x_signed)); |
| 1070 | 1078 | CHECK_FALSE(CLI::detail::lexical_cast(empty_input, x_unsigned)); | ... | ... |