mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-30 04:33:53 +00:00
update supported cmake versions and add some tests with newer compilers (#972)
Update and test with some newer compilers and cmake versions --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
9dfeefe2ba
commit
35aa92d71a
17
.ci/azure-cmake-new.yml
Normal file
17
.ci/azure-cmake-new.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
steps:
|
||||||
|
# Note that silkeh/clang does not include ca-certificates, so check the shasum for verification
|
||||||
|
- bash: |
|
||||||
|
wget --no-check-certificate "https://cmake.org/files/v3.28/cmake-3.28.0-linux-x86_64.tar.gz"
|
||||||
|
echo "898f0b5ca6e2ea5286998e97bd33f030d7d09f18ca4b88be661fdfbad5dadd88 cmake-3.28.0-linux-x86_64.tar.gz" | shasum -sca 256
|
||||||
|
displayName: Download CMake
|
||||||
|
|
||||||
|
- task: ExtractFiles@1
|
||||||
|
inputs:
|
||||||
|
archiveFilePatterns: "cmake*.tar.gz"
|
||||||
|
destinationFolder: "cmake_program"
|
||||||
|
displayName: Extract CMake
|
||||||
|
|
||||||
|
- bash:
|
||||||
|
echo
|
||||||
|
"##vso[task.prependpath]$(Build.SourcesDirectory)/cmake_program/cmake-3.28.0-linux-x86_64/bin"
|
||||||
|
displayName: Add CMake to PATH
|
@ -6,6 +6,7 @@
|
|||||||
# modernize-avoid-c-arrays trips up in TEMPLATE_TEST_CASE catch macro
|
# modernize-avoid-c-arrays trips up in TEMPLATE_TEST_CASE catch macro
|
||||||
# modernize-return-braced-init-list triggers on lambdas ?
|
# modernize-return-braced-init-list triggers on lambdas ?
|
||||||
# modernize-make-unique requires C++14
|
# modernize-make-unique requires C++14
|
||||||
|
# modernize-type_traits requires C++17
|
||||||
# readability-avoid-const-params-in-decls Affected by the pre-compile split
|
# readability-avoid-const-params-in-decls Affected by the pre-compile split
|
||||||
|
|
||||||
Checks: |
|
Checks: |
|
||||||
@ -37,6 +38,8 @@ Checks: |
|
|||||||
-modernize-concat-nested-namespaces,
|
-modernize-concat-nested-namespaces,
|
||||||
-modernize-return-braced-init-list,
|
-modernize-return-braced-init-list,
|
||||||
-modernize-make-unique,
|
-modernize-make-unique,
|
||||||
|
-modernize-type-traits,
|
||||||
|
-modernize-macro-to-enum,
|
||||||
*performance*,
|
*performance*,
|
||||||
-performance-unnecessary-value-param,
|
-performance-unnecessary-value-param,
|
||||||
-performance-inefficient-string-concatenation,
|
-performance-inefficient-string-concatenation,
|
||||||
|
12
.github/workflows/tests.yml
vendored
12
.github/workflows/tests.yml
vendored
@ -60,7 +60,7 @@ jobs:
|
|||||||
clang-tidy:
|
clang-tidy:
|
||||||
name: Clang-Tidy
|
name: Clang-Tidy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: silkeh/clang:14
|
container: silkeh/clang:17
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ jobs:
|
|||||||
cuda12-build:
|
cuda12-build:
|
||||||
name: CUDA 12 build only
|
name: CUDA 12 build only
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: nvidia/cuda:12.1.0-devel-ubuntu22.04
|
container: nvidia/cuda:12.3.1-devel-ubuntu22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Add build tools
|
- name: Add build tools
|
||||||
run: apt-get update && apt-get install -y wget git cmake
|
run: apt-get update && apt-get install -y wget git cmake
|
||||||
@ -336,9 +336,15 @@ jobs:
|
|||||||
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
|
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
|
|
||||||
- name: Check CMake 3.27 (full)
|
- name: Check CMake 3.27
|
||||||
uses: ./.github/actions/quick_cmake
|
uses: ./.github/actions/quick_cmake
|
||||||
with:
|
with:
|
||||||
cmake-version: "3.27"
|
cmake-version: "3.27"
|
||||||
|
if: success() || failure()
|
||||||
|
|
||||||
|
- name: Check CMake 3.28 (full)
|
||||||
|
uses: ./.github/actions/quick_cmake
|
||||||
|
with:
|
||||||
|
cmake-version: "3.28"
|
||||||
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
|
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
|
@ -2,14 +2,14 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
# Note: this is a header only library. If you have an older CMake than 3.5,
|
# Note: this is a header only library. If you have an older CMake than 3.5,
|
||||||
# just add the CLI11/include directory and that's all you need to do.
|
# just add the CLI11/include directory and that's all you need to do.
|
||||||
|
|
||||||
# Make sure users don't get warnings on a tested (3.5 to 3.26) version
|
# Make sure users don't get warnings on a tested (3.5 to 3.28) version
|
||||||
# of CMake. For most of the policies, the new version is better (hence the change).
|
# of CMake. For most of the policies, the new version is better (hence the change).
|
||||||
# We don't use the 3.5...3.26 syntax because of a bug in an older MSVC's
|
# We don't use the 3.5...3.28 syntax because of a bug in an older MSVC's
|
||||||
# built-in and modified CMake 3.11
|
# built-in and modified CMake 3.11
|
||||||
if(${CMAKE_VERSION} VERSION_LESS 3.26)
|
if(${CMAKE_VERSION} VERSION_LESS 3.28)
|
||||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||||
else()
|
else()
|
||||||
cmake_policy(VERSION 3.26)
|
cmake_policy(VERSION 3.28)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")
|
set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")
|
||||||
|
@ -150,3 +150,28 @@ jobs:
|
|||||||
- template: .ci/azure-cmake.yml
|
- template: .ci/azure-cmake.yml
|
||||||
- template: .ci/azure-build.yml
|
- template: .ci/azure-build.yml
|
||||||
- template: .ci/azure-test.yml
|
- template: .ci/azure-test.yml
|
||||||
|
|
||||||
|
- job: Docker_new
|
||||||
|
variables:
|
||||||
|
cli11.single: OFF
|
||||||
|
pool:
|
||||||
|
vmImage: "ubuntu-latest"
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
gcc13:
|
||||||
|
containerImage: gcc:13
|
||||||
|
cli11.std: 17
|
||||||
|
cli11.options: -DCMAKE_CXX_FLAGS="-Wstrict-overflow=5"
|
||||||
|
gcc12:
|
||||||
|
containerImage: gcc:12
|
||||||
|
cli11.std: 20
|
||||||
|
cli11.options: -DCMAKE_CXX_FLAGS="-Wredundant-decls -Wconversion"
|
||||||
|
clang17_20:
|
||||||
|
containerImage: silkeh/clang:17
|
||||||
|
cli11.std: 23
|
||||||
|
cli11.options: -DCMAKE_CXX_FLAGS=-std=c++23
|
||||||
|
container: $[ variables['containerImage'] ]
|
||||||
|
steps:
|
||||||
|
- template: .ci/azure-cmake-new.yml
|
||||||
|
- template: .ci/azure-build.yml
|
||||||
|
- template: .ci/azure-test.yml
|
||||||
|
@ -283,7 +283,7 @@ CLI::Option* opt = app.add_flag("--opt");
|
|||||||
CLI11_PARSE(app, argv, argc);
|
CLI11_PARSE(app, argv, argc);
|
||||||
|
|
||||||
if(* opt)
|
if(* opt)
|
||||||
std::cout << "Flag received " << opt->count() << " times." << std::endl;
|
std::cout << "Flag received " << opt->count() << " times." << '\n';
|
||||||
```
|
```
|
||||||
|
|
||||||
## Inheritance of defaults
|
## Inheritance of defaults
|
||||||
|
@ -25,10 +25,10 @@ int main(int argc, const char *argv[]) {
|
|||||||
subcom->alias("--sub");
|
subcom->alias("--sub");
|
||||||
CLI11_PARSE(app, argc, argv);
|
CLI11_PARSE(app, argc, argv);
|
||||||
|
|
||||||
std::cout << "value=" << value << std::endl;
|
std::cout << "value=" << value << '\n';
|
||||||
std::cout << "after Args:";
|
std::cout << "after Args:";
|
||||||
for(const auto &aarg : subcom->remaining()) {
|
for(const auto &aarg : subcom->remaining()) {
|
||||||
std::cout << aarg << " ";
|
std::cout << aarg << " ";
|
||||||
}
|
}
|
||||||
std::cout << std::endl;
|
std::cout << '\n';
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,11 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Working on file: " << file << ", direct count: " << app.count("--file")
|
std::cout << "Working on file: " << file << ", direct count: " << app.count("--file")
|
||||||
<< ", opt count: " << opt->count() << std::endl;
|
<< ", opt count: " << opt->count() << '\n';
|
||||||
std::cout << "Working on count: " << count << ", direct count: " << app.count("--count")
|
std::cout << "Working on count: " << count << ", direct count: " << app.count("--count")
|
||||||
<< ", opt count: " << copt->count() << std::endl;
|
<< ", opt count: " << copt->count() << '\n';
|
||||||
std::cout << "Received flag: " << v << " (" << flag->count() << ") times\n";
|
std::cout << "Received flag: " << v << " (" << flag->count() << ") times\n";
|
||||||
std::cout << "Some value: " << value << std::endl;
|
std::cout << "Some value: " << value << '\n';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ using DoubleValues = Values<double>;
|
|||||||
|
|
||||||
// the lexical cast operator should be in the same namespace as the type for ADL to work properly
|
// the lexical cast operator should be in the same namespace as the type for ADL to work properly
|
||||||
bool lexical_cast(const std::string &input, Values<double> & /*v*/) {
|
bool lexical_cast(const std::string &input, Values<double> & /*v*/) {
|
||||||
std::cout << "called correct lexical_cast function ! val: " << input << std::endl;
|
std::cout << "called correct lexical_cast function ! val: " << input << '\n';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,6 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
CLI11_PARSE(app, argc, argv);
|
CLI11_PARSE(app, argc, argv);
|
||||||
|
|
||||||
std::cout << "value = " << val << std::endl;
|
std::cout << "value = " << val << '\n';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// CLI11's built in enum streaming can be used outside CLI11 like this:
|
// CLI11's built in enum streaming can be used outside CLI11 like this:
|
||||||
using CLI::enums::operator<<;
|
using CLI::enums::operator<<;
|
||||||
std::cout << "Enum received: " << level << std::endl;
|
std::cout << "Enum received: " << level << '\n';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// CLI11's built in enum streaming can be used outside CLI11 like this:
|
// CLI11's built in enum streaming can be used outside CLI11 like this:
|
||||||
using CLI::enums::operator<<;
|
using CLI::enums::operator<<;
|
||||||
std::cout << "Enum received: " << level << std::endl;
|
std::cout << "Enum received: " << level << '\n';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
CLI11_PARSE(app, argc, argv);
|
CLI11_PARSE(app, argc, argv);
|
||||||
|
|
||||||
std::cout << "This app was meant to show off the formatter, run with -h" << std::endl;
|
std::cout << "This app was meant to show off the formatter, run with -h" << '\n';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,10 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Working on file: " << file << ", direct count: " << app.count("--file")
|
std::cout << "Working on file: " << file << ", direct count: " << app.count("--file")
|
||||||
<< ", opt count: " << opt->count() << std::endl;
|
<< ", opt count: " << opt->count() << '\n';
|
||||||
std::cout << "Working on count: " << count << ", direct count: " << app.count("--count")
|
std::cout << "Working on count: " << count << ", direct count: " << app.count("--count")
|
||||||
<< ", opt count: " << copt->count() << std::endl;
|
<< ", opt count: " << copt->count() << '\n';
|
||||||
std::cout << "Some value: " << value << std::endl;
|
std::cout << "Some value: " << value << '\n';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,6 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// Prove the vector is correct
|
// Prove the vector is correct
|
||||||
for(auto &pair : keyval) {
|
for(auto &pair : keyval) {
|
||||||
std::cout << pair.first << " : " << pair.second << std::endl;
|
std::cout << pair.first << " : " << pair.second << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,10 @@ Note that this will not shortcut `->required` and other similar options.)raw"};
|
|||||||
if(*help)
|
if(*help)
|
||||||
throw CLI::CallForHelp();
|
throw CLI::CallForHelp();
|
||||||
} catch(const CLI::Error &e) {
|
} catch(const CLI::Error &e) {
|
||||||
std::cout << "Option -a string in help: " << some_option << std::endl;
|
std::cout << "Option -a string in help: " << some_option << '\n';
|
||||||
return test.exit(e);
|
return test.exit(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Option -a string: " << some_option << std::endl;
|
std::cout << "Option -a string: " << some_option << '\n';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,13 @@ int main(int argc, char **argv) {
|
|||||||
CLI11_PARSE(app, argc, argv);
|
CLI11_PARSE(app, argc, argv);
|
||||||
|
|
||||||
std::string format_type = (csv) ? std::string("CSV") : ((human) ? "human readable" : "binary");
|
std::string format_type = (csv) ? std::string("CSV") : ((human) ? "human readable" : "binary");
|
||||||
std::cout << "Selected " << format_type << " format" << std::endl;
|
std::cout << "Selected " << format_type << " format\n";
|
||||||
if(!fileLoc.empty()) {
|
if(!fileLoc.empty()) {
|
||||||
std::cout << " sent to file " << fileLoc << std::endl;
|
std::cout << " sent to file " << fileLoc << '\n';
|
||||||
} else if(!networkAddress.empty()) {
|
} else if(!networkAddress.empty()) {
|
||||||
std::cout << " sent over network to " << networkAddress << std::endl;
|
std::cout << " sent over network to " << networkAddress << '\n';
|
||||||
} else {
|
} else {
|
||||||
std::cout << " sent to std::cout" << std::endl;
|
std::cout << " sent to std::cout\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -25,11 +25,11 @@ int main(int argc, char **argv) {
|
|||||||
for(int v : vals)
|
for(int v : vals)
|
||||||
std::cout << ": " << v << " ";
|
std::cout << ": " << v << " ";
|
||||||
|
|
||||||
std::cout << std::endl << "Remaining commands: ";
|
std::cout << '\n' << "Remaining commands: ";
|
||||||
|
|
||||||
for(const auto &com : more_comms)
|
for(const auto &com : more_comms)
|
||||||
std::cout << com << " ";
|
std::cout << com << " ";
|
||||||
std::cout << std::endl;
|
std::cout << '\n';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ int main(int argc, char **argv) {
|
|||||||
int circle_counter{0};
|
int circle_counter{0};
|
||||||
circle->callback([&radius, &circle_counter] {
|
circle->callback([&radius, &circle_counter] {
|
||||||
++circle_counter;
|
++circle_counter;
|
||||||
std::cout << "circle" << circle_counter << " with radius " << radius << std::endl;
|
std::cout << "circle" << circle_counter << " with radius " << radius << '\n';
|
||||||
});
|
});
|
||||||
|
|
||||||
circle->add_option("radius", radius, "the radius of the circle")->required();
|
circle->add_option("radius", radius, "the radius of the circle")->required();
|
||||||
@ -32,7 +32,7 @@ int main(int argc, char **argv) {
|
|||||||
if(edge2 == 0) {
|
if(edge2 == 0) {
|
||||||
edge2 = edge1;
|
edge2 = edge1;
|
||||||
}
|
}
|
||||||
std::cout << "rectangle" << rect_counter << " with edges [" << edge1 << ',' << edge2 << "]" << std::endl;
|
std::cout << "rectangle" << rect_counter << " with edges [" << edge1 << ',' << edge2 << "]\n";
|
||||||
edge2 = 0;
|
edge2 = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ int main(int argc, char **argv) {
|
|||||||
tri->callback([&sides, &tri_counter] {
|
tri->callback([&sides, &tri_counter] {
|
||||||
++tri_counter;
|
++tri_counter;
|
||||||
|
|
||||||
std::cout << "triangle" << tri_counter << " with sides [" << CLI::detail::join(sides) << "]" << std::endl;
|
std::cout << "triangle" << tri_counter << " with sides [" << CLI::detail::join(sides) << "]\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
tri->add_option("sides", sides, "the side lengths of the triangle");
|
tri->add_option("sides", sides, "the side lengths of the triangle");
|
||||||
|
@ -28,11 +28,11 @@ int main(int argc, char **argv) {
|
|||||||
CLI11_PARSE(app, argc, argv);
|
CLI11_PARSE(app, argc, argv);
|
||||||
|
|
||||||
std::cout << "Working on file: " << file << ", direct count: " << app.count("--file")
|
std::cout << "Working on file: " << file << ", direct count: " << app.count("--file")
|
||||||
<< ", opt count: " << opt->count() << std::endl;
|
<< ", opt count: " << opt->count() << '\n';
|
||||||
std::cout << "Working on count: " << count << ", direct count: " << app.count("--count")
|
std::cout << "Working on count: " << count << ", direct count: " << app.count("--count")
|
||||||
<< ", opt count: " << copt->count() << std::endl;
|
<< ", opt count: " << copt->count() << '\n';
|
||||||
std::cout << "Received flag: " << v << " (" << flag->count() << ") times\n";
|
std::cout << "Received flag: " << v << " (" << flag->count() << ") times\n";
|
||||||
std::cout << "Some value: " << value << std::endl;
|
std::cout << "Some value: " << value << '\n';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ int main(int argc, char *argv[]) {
|
|||||||
cli_sub.add_option("sub_arg", sub_arg, "Argument for subcommand")->required();
|
cli_sub.add_option("sub_arg", sub_arg, "Argument for subcommand")->required();
|
||||||
CLI11_PARSE(cli_global, argc, argv);
|
CLI11_PARSE(cli_global, argc, argv);
|
||||||
if(cli_sub) {
|
if(cli_sub) {
|
||||||
std::cout << "Got: " << sub_arg << std::endl;
|
std::cout << "Got: " << sub_arg << '\n';
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ void setup_subcommand_a(CLI::App &app) {
|
|||||||
/// but having a separate function is cleaner.
|
/// but having a separate function is cleaner.
|
||||||
void run_subcommand_a(SubcommandAOptions const &opt) {
|
void run_subcommand_a(SubcommandAOptions const &opt) {
|
||||||
// Do stuff...
|
// Do stuff...
|
||||||
std::cout << "Working on file: " << opt.file << std::endl;
|
std::cout << "Working on file: " << opt.file << '\n';
|
||||||
if(opt.with_foo) {
|
if(opt.with_foo) {
|
||||||
std::cout << "Using foo!" << std::endl;
|
std::cout << "Using foo!" << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,10 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Working on file: " << file << ", direct count: " << impOpt->count("--file")
|
std::cout << "Working on file: " << file << ", direct count: " << impOpt->count("--file")
|
||||||
<< ", opt count: " << opt->count() << std::endl;
|
<< ", opt count: " << opt->count() << '\n';
|
||||||
std::cout << "Working on count: " << count << ", direct count: " << impOpt->count("--count")
|
std::cout << "Working on count: " << count << ", direct count: " << impOpt->count("--count")
|
||||||
<< ", opt count: " << copt->count() << std::endl;
|
<< ", opt count: " << copt->count() << '\n';
|
||||||
std::cout << "Some value: " << value << std::endl;
|
std::cout << "Some value: " << value << '\n';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,11 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
CLI11_PARSE(app, argc, argv);
|
CLI11_PARSE(app, argc, argv);
|
||||||
|
|
||||||
std::cout << "Working on --file from start: " << file << std::endl;
|
std::cout << "Working on --file from start: " << file << '\n';
|
||||||
std::cout << "Working on --count from stop: " << s->count() << ", direct count: " << stop->count("--count")
|
std::cout << "Working on --count from stop: " << s->count() << ", direct count: " << stop->count("--count") << '\n';
|
||||||
<< std::endl;
|
std::cout << "Count of --random flag: " << app.count("--random") << '\n';
|
||||||
std::cout << "Count of --random flag: " << app.count("--random") << std::endl;
|
|
||||||
for(auto *subcom : app.get_subcommands())
|
for(auto *subcom : app.get_subcommands())
|
||||||
std::cout << "Subcommand: " << subcom->get_name() << std::endl;
|
std::cout << "Subcommand: " << subcom->get_name() << '\n';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,10 @@ int main(int argc, const char *argv[]) {
|
|||||||
auto *subcom = app.add_subcommand("sub", "")->prefix_command();
|
auto *subcom = app.add_subcommand("sub", "")->prefix_command();
|
||||||
CLI11_PARSE(app, argc, argv);
|
CLI11_PARSE(app, argc, argv);
|
||||||
|
|
||||||
std::cout << "value =" << value << std::endl;
|
std::cout << "value =" << value << '\n';
|
||||||
std::cout << "after Args:";
|
std::cout << "after Args:";
|
||||||
for(const auto &aarg : subcom->remaining()) {
|
for(const auto &aarg : subcom->remaining()) {
|
||||||
std::cout << aarg << " ";
|
std::cout << aarg << " ";
|
||||||
}
|
}
|
||||||
std::cout << std::endl;
|
std::cout << '\n';
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ int main(int argc, char **argv) {
|
|||||||
app.add_option("-v,--value", count, "Value in range")->check(CLI::Range(3, 6));
|
app.add_option("-v,--value", count, "Value in range")->check(CLI::Range(3, 6));
|
||||||
CLI11_PARSE(app, argc, argv);
|
CLI11_PARSE(app, argc, argv);
|
||||||
|
|
||||||
std::cout << "Try printing help or failing the validator" << std::endl;
|
std::cout << "Try printing help or failing the validator" << '\n';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ class AutoTimer : public Timer {
|
|||||||
// GCC 4.7 does not support using inheriting constructors.
|
// GCC 4.7 does not support using inheriting constructors.
|
||||||
|
|
||||||
/// This destructor prints the string
|
/// This destructor prints the string
|
||||||
~AutoTimer() { std::cout << to_string() << std::endl; }
|
~AutoTimer() { std::cout << to_string() << '\n'; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CLI
|
} // namespace CLI
|
||||||
|
@ -1384,9 +1384,7 @@ bool lexical_conversion(const std::vector<std ::string> &strings, AssignTo &outp
|
|||||||
FirstType v1;
|
FirstType v1;
|
||||||
SecondType v2;
|
SecondType v2;
|
||||||
bool retval = lexical_assign<FirstType, FirstType>(strings[0], v1);
|
bool retval = lexical_assign<FirstType, FirstType>(strings[0], v1);
|
||||||
if(strings.size() > 1) {
|
retval = retval && lexical_assign<SecondType, SecondType>((strings.size() > 1) ? strings[1] : std::string{}, v2);
|
||||||
retval = retval && lexical_assign<SecondType, SecondType>(strings[1], v2);
|
|
||||||
}
|
|
||||||
if(retval) {
|
if(retval) {
|
||||||
output = AssignTo{v1, v2};
|
output = AssignTo{v1, v2};
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,7 @@ CLI11_INLINE int App::exit(const Error &e, std::ostream &out, std::ostream &err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(e.get_name() == "CallForVersion") {
|
if(e.get_name() == "CallForVersion") {
|
||||||
out << e.what() << std::endl;
|
out << e.what() << '\n';
|
||||||
return e.get_exit_code();
|
return e.get_exit_code();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,11 @@ generate_parents(const std::string §ion, std::string &name, char parentSepar
|
|||||||
parents.insert(parents.end(), plist.begin(), plist.end());
|
parents.insert(parents.end(), plist.begin(), plist.end());
|
||||||
}
|
}
|
||||||
// clean up quotes on the parents
|
// clean up quotes on the parents
|
||||||
detail::remove_quotes(parents);
|
try {
|
||||||
|
detail::remove_quotes(parents);
|
||||||
|
} catch(const std::invalid_argument &iarg) {
|
||||||
|
throw CLI::ParseError(iarg.what(), CLI::ExitCodes::InvalidError);
|
||||||
|
}
|
||||||
return parents;
|
return parents;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,8 +345,8 @@ inline std::vector<ConfigItem> ConfigBase::from_config(std::istream &input) cons
|
|||||||
if(keyChar == '\"') {
|
if(keyChar == '\"') {
|
||||||
try {
|
try {
|
||||||
item = detail::remove_escaped_characters(item);
|
item = detail::remove_escaped_characters(item);
|
||||||
} catch(const std::invalid_argument &ia) {
|
} catch(const std::invalid_argument &iarg) {
|
||||||
throw CLI::ParseError(ia.what(), CLI::ExitCodes::InvalidError);
|
throw CLI::ParseError(iarg.what(), CLI::ExitCodes::InvalidError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -366,7 +370,11 @@ inline std::vector<ConfigItem> ConfigBase::from_config(std::istream &input) cons
|
|||||||
detail::trim(multiline);
|
detail::trim(multiline);
|
||||||
item += multiline;
|
item += multiline;
|
||||||
}
|
}
|
||||||
items_buffer = detail::split_up(item.substr(1, item.length() - 2), aSep);
|
if(item.back() == aEnd) {
|
||||||
|
items_buffer = detail::split_up(item.substr(1, item.length() - 2), aSep);
|
||||||
|
} else {
|
||||||
|
items_buffer = detail::split_up(item.substr(1, std::string::npos), aSep);
|
||||||
|
}
|
||||||
} else if((isDefaultArray || isINIArray) && item.find_first_of(aSep) != std::string::npos) {
|
} else if((isDefaultArray || isINIArray) && item.find_first_of(aSep) != std::string::npos) {
|
||||||
items_buffer = detail::split_up(item, aSep);
|
items_buffer = detail::split_up(item, aSep);
|
||||||
} else if((isDefaultArray || isINIArray) && item.find_first_of(' ') != std::string::npos) {
|
} else if((isDefaultArray || isINIArray) && item.find_first_of(' ') != std::string::npos) {
|
||||||
|
@ -132,7 +132,7 @@ CLI11_INLINE std::string Formatter::make_usage(const App *app, std::string name)
|
|||||||
<< (app->get_require_subcommand_min() == 0 ? "]" : "");
|
<< (app->get_require_subcommand_min() == 0 ? "]" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl;
|
out << '\n';
|
||||||
|
|
||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
|
@ -623,11 +623,11 @@ CLI11_INLINE void Option::_reduce_results(results_t &out, const results_t &origi
|
|||||||
// {} is the indicator for an empty container
|
// {} is the indicator for an empty container
|
||||||
if(out.empty()) {
|
if(out.empty()) {
|
||||||
if(original.size() == 1 && original[0] == "{}" && get_items_expected_min() > 0) {
|
if(original.size() == 1 && original[0] == "{}" && get_items_expected_min() > 0) {
|
||||||
out.push_back("{}");
|
out.emplace_back("{}");
|
||||||
out.push_back("%%");
|
out.emplace_back("%%");
|
||||||
}
|
}
|
||||||
} else if(out.size() == 1 && out[0] == "{}" && get_items_expected_min() > 0) {
|
} else if(out.size() == 1 && out[0] == "{}" && get_items_expected_min() > 0) {
|
||||||
out.push_back("%%");
|
out.emplace_back("%%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,9 +614,9 @@ TEST_CASE_METHOD(TApp, "IniNotRequired", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one = 0, two = 0, three = 0;
|
int one = 0, two = 0, three = 0;
|
||||||
@ -651,8 +651,8 @@ TEST_CASE_METHOD(TApp, "IniSuccessOnUnknownOption", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int two{0};
|
int two{0};
|
||||||
@ -671,8 +671,8 @@ TEST_CASE_METHOD(TApp, "IniGetRemainingOption", "[config]") {
|
|||||||
std::string ExtraOptionValue = "3";
|
std::string ExtraOptionValue = "3";
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << ExtraOption << "=" << ExtraOptionValue << std::endl;
|
out << ExtraOption << "=" << ExtraOptionValue << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int two{0};
|
int two{0};
|
||||||
@ -694,7 +694,7 @@ TEST_CASE_METHOD(TApp, "IniRemainingSub", "[config]") {
|
|||||||
out << "[map]\n";
|
out << "[map]\n";
|
||||||
out << "a = 1\n";
|
out << "a = 1\n";
|
||||||
out << "b=[1,2,3]\n";
|
out << "b=[1,2,3]\n";
|
||||||
out << "c = 3" << std::endl;
|
out << "c = 3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -727,7 +727,7 @@ TEST_CASE_METHOD(TApp, "IniGetNoRemaining", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int two{0};
|
int two{0};
|
||||||
@ -773,9 +773,9 @@ TEST_CASE_METHOD(TApp, "IniRequiredbadConfigurator", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
app.set_config("--config", tmpini)->required();
|
app.set_config("--config", tmpini)->required();
|
||||||
@ -791,9 +791,9 @@ TEST_CASE_METHOD(TApp, "IniNotRequiredbadConfigurator", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
app.set_config("--config", tmpini);
|
app.set_config("--config", tmpini);
|
||||||
@ -814,16 +814,16 @@ TEST_CASE_METHOD(TApp, "IniNotRequiredNotDefault", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini2};
|
std::ofstream out{tmpini2};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=98" << std::endl;
|
out << "two=98" << '\n';
|
||||||
out << "three=4" << std::endl;
|
out << "three=4" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -852,9 +852,9 @@ TEST_CASE_METHOD(TApp, "IniEnvironmentalFileName", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -883,16 +883,16 @@ TEST_CASE_METHOD(TApp, "MultiConfig", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini2};
|
std::ofstream out{tmpini2};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "one=55" << std::endl;
|
out << "one=55" << '\n';
|
||||||
out << "three=4" << std::endl;
|
out << "three=4" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -924,16 +924,16 @@ TEST_CASE_METHOD(TApp, "MultiConfig_takelast", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini2};
|
std::ofstream out{tmpini2};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "one=55" << std::endl;
|
out << "one=55" << '\n';
|
||||||
out << "three=4" << std::endl;
|
out << "three=4" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -966,16 +966,16 @@ TEST_CASE_METHOD(TApp, "MultiConfig_takeAll", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini2};
|
std::ofstream out{tmpini2};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "one=55" << std::endl;
|
out << "one=55" << '\n';
|
||||||
out << "three=4" << std::endl;
|
out << "three=4" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1008,16 +1008,16 @@ TEST_CASE_METHOD(TApp, "MultiConfig_single", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini2};
|
std::ofstream out{tmpini2};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "one=55" << std::endl;
|
out << "one=55" << '\n';
|
||||||
out << "three=4" << std::endl;
|
out << "three=4" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1063,8 +1063,8 @@ TEST_CASE_METHOD(TApp, "IniOverwrite", "[config]") {
|
|||||||
TempFile tmpini{"TestIniTmp.ini"};
|
TempFile tmpini{"TestIniTmp.ini"};
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string orig = "filename_not_exist.ini";
|
std::string orig = "filename_not_exist.ini";
|
||||||
@ -1088,9 +1088,9 @@ TEST_CASE_METHOD(TApp, "IniRequired", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1131,9 +1131,9 @@ TEST_CASE_METHOD(TApp, "IniInlineComment", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99 ; this is a two" << std::endl;
|
out << "two=99 ; this is a two" << '\n';
|
||||||
out << "three=3; this is a three" << std::endl;
|
out << "three=3; this is a three" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1173,9 +1173,9 @@ TEST_CASE_METHOD(TApp, "TomlInlineComment", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99 # this is a two" << std::endl;
|
out << "two=99 # this is a two" << '\n';
|
||||||
out << "three=3# this is a three" << std::endl;
|
out << "three=3# this is a three" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1215,12 +1215,12 @@ TEST_CASE_METHOD(TApp, "TomlDocStringComment", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
out << R"(""")" << std::endl;
|
out << R"(""")" << '\n';
|
||||||
out << "one=35" << std::endl;
|
out << "one=35" << '\n';
|
||||||
out << R"(""")" << std::endl;
|
out << R"(""")" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1242,12 +1242,12 @@ TEST_CASE_METHOD(TApp, "TomlDocStringComment2", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "'''" << std::endl;
|
out << "'''" << '\n';
|
||||||
out << "one=35" << std::endl;
|
out << "one=35" << '\n';
|
||||||
out << "last comment line three=6 '''" << std::endl;
|
out << "last comment line three=6 '''" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1269,11 +1269,11 @@ TEST_CASE_METHOD(TApp, "TomlDocStringComment3", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=99" << std::endl;
|
out << "two=99" << '\n';
|
||||||
out << "three=3" << std::endl;
|
out << "three=3" << '\n';
|
||||||
out << "'''" << std::endl;
|
out << "'''" << '\n';
|
||||||
out << "one=35" << std::endl;
|
out << "one=35" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1318,9 +1318,9 @@ TEST_CASE_METHOD(TApp, "IniVector", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=2 3" << std::endl;
|
out << "two=2 3" << '\n';
|
||||||
out << "three=1 2 3" << std::endl;
|
out << "three=1 2 3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> two, three;
|
std::vector<int> two, three;
|
||||||
@ -1519,11 +1519,11 @@ TEST_CASE_METHOD(TApp, "IniLayered", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "subsubcom.val=3" << std::endl;
|
out << "subsubcom.val=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1551,11 +1551,11 @@ TEST_CASE_METHOD(TApp, "IniLayeredStream", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "subsubcom.val=3" << std::endl;
|
out << "subsubcom.val=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1584,12 +1584,12 @@ TEST_CASE_METHOD(TApp, "IniLayeredDotSection", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "[subcom.subsubcom]" << std::endl;
|
out << "[subcom.subsubcom]" << '\n';
|
||||||
out << "val=3" << std::endl;
|
out << "val=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1623,12 +1623,12 @@ TEST_CASE_METHOD(TApp, "IniLayeredDotSectionInQuotes", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "['subcom']" << std::endl;
|
out << "['subcom']" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "['subcom'.\"subsubcom\"]" << std::endl;
|
out << "['subcom'.\"subsubcom\"]" << '\n';
|
||||||
out << "val=3" << std::endl;
|
out << "val=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1662,12 +1662,12 @@ TEST_CASE_METHOD(TApp, "IniLayeredCustomSectionSeparator", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "[subcom|subsubcom]" << std::endl;
|
out << "[subcom|subsubcom]" << '\n';
|
||||||
out << "val=3" << std::endl;
|
out << "val=3" << '\n';
|
||||||
}
|
}
|
||||||
app.get_config_formatter_base()->parentSeparator('|');
|
app.get_config_formatter_base()->parentSeparator('|');
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1695,10 +1695,10 @@ TEST_CASE_METHOD(TApp, "IniLayeredOptionGroupAlias", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[ogroup]" << std::endl;
|
out << "[ogroup]" << '\n';
|
||||||
out << "val2=2" << std::endl;
|
out << "val2=2" << '\n';
|
||||||
}
|
}
|
||||||
int one{0}, two{0};
|
int one{0}, two{0};
|
||||||
app.add_option("--val", one);
|
app.add_option("--val", one);
|
||||||
@ -1719,11 +1719,11 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurable", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "subsubcom.val=3" << std::endl;
|
out << "subsubcom.val=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1753,11 +1753,11 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableInQuotes", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "\"subsubcom\".'val'=3" << std::endl;
|
out << "\"subsubcom\".'val'=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1787,11 +1787,11 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableInQuotesAlias", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << R"("sub\tsub\t.com".'val'=3)" << std::endl;
|
out << R"("sub\tsub\t.com".'val'=3)" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1821,11 +1821,11 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableInQuotesAliasWithEquals", "[con
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << R"("sub=sub=.com".'val'=3)" << std::endl;
|
out << R"("sub=sub=.com".'val'=3)" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1855,11 +1855,11 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableInQuotesAliasWithComment", "[co
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << R"("sub#sub;.com".'val'=3)" << std::endl;
|
out << R"("sub#sub;.com".'val'=3)" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0};
|
int one{0}, two{0}, three{0};
|
||||||
@ -1885,11 +1885,11 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurablePreParse", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "subsubcom.val=3" << std::endl;
|
out << "subsubcom.val=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0}, four{0};
|
int one{0}, two{0}, three{0}, four{0};
|
||||||
@ -1927,11 +1927,11 @@ TEST_CASE_METHOD(TApp, "IniSection", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[config]" << std::endl;
|
out << "[config]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "subsubcom.val=3" << std::endl;
|
out << "subsubcom.val=3" << '\n';
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int val{0};
|
int val{0};
|
||||||
@ -1951,11 +1951,11 @@ TEST_CASE_METHOD(TApp, "IniSection2", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[config]" << std::endl;
|
out << "[config]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "subsubcom.val=3" << std::endl;
|
out << "subsubcom.val=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int val{0};
|
int val{0};
|
||||||
@ -1975,11 +1975,11 @@ TEST_CASE_METHOD(TApp, "jsonLikeParsing", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpjson};
|
std::ofstream out{tmpjson};
|
||||||
out << "{" << std::endl;
|
out << "{" << '\n';
|
||||||
out << "\"val\":1," << std::endl;
|
out << "\"val\":1," << '\n';
|
||||||
out << R"("val2":"test",)" << std::endl;
|
out << R"("val2":"test",)" << '\n';
|
||||||
out << "\"flag\":true" << std::endl;
|
out << "\"flag\":true" << '\n';
|
||||||
out << "}" << std::endl;
|
out << "}" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int val{0};
|
int val{0};
|
||||||
@ -2006,17 +2006,17 @@ TEST_CASE_METHOD(TApp, "TomlSectionNumber", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[[config]]" << std::endl;
|
out << "[[config]]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "subsubcom.val=3" << std::endl;
|
out << "subsubcom.val=3" << '\n';
|
||||||
out << "[[config]]" << std::endl;
|
out << "[[config]]" << '\n';
|
||||||
out << "val=4" << std::endl;
|
out << "val=4" << '\n';
|
||||||
out << "subsubcom.val=3" << std::endl;
|
out << "subsubcom.val=3" << '\n';
|
||||||
out << "[[config]]" << std::endl;
|
out << "[[config]]" << '\n';
|
||||||
out << "val=6" << std::endl;
|
out << "val=6" << '\n';
|
||||||
out << "subsubcom.val=3" << std::endl;
|
out << "subsubcom.val=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int val{0};
|
int val{0};
|
||||||
@ -2050,12 +2050,12 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableParseComplete", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "[subcom.subsubcom]" << std::endl;
|
out << "[subcom.subsubcom]" << '\n';
|
||||||
out << "val=3" << std::endl;
|
out << "val=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0}, four{0};
|
int one{0}, two{0}, three{0}, four{0};
|
||||||
@ -2095,14 +2095,14 @@ TEST_CASE_METHOD(TApp, "IniSubcommandMultipleSections", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
out << "[subcom]" << std::endl;
|
out << "[subcom]" << '\n';
|
||||||
out << "val=2" << std::endl;
|
out << "val=2" << '\n';
|
||||||
out << "[subcom.subsubcom]" << std::endl;
|
out << "[subcom.subsubcom]" << '\n';
|
||||||
out << "val=3" << std::endl;
|
out << "val=3" << '\n';
|
||||||
out << "[subcom2]" << std::endl;
|
out << "[subcom2]" << '\n';
|
||||||
out << "val=4" << std::endl;
|
out << "val=4" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int one{0}, two{0}, three{0}, four{0};
|
int one{0}, two{0}, three{0}, four{0};
|
||||||
@ -2143,9 +2143,9 @@ TEST_CASE_METHOD(TApp, "DuplicateSubcommandCallbacks", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmptoml};
|
std::ofstream out{tmptoml};
|
||||||
out << "[[foo]]" << std::endl;
|
out << "[[foo]]" << '\n';
|
||||||
out << "[[foo]]" << std::endl;
|
out << "[[foo]]" << '\n';
|
||||||
out << "[[foo]]" << std::endl;
|
out << "[[foo]]" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *foo = app.add_subcommand("foo");
|
auto *foo = app.add_subcommand("foo");
|
||||||
@ -2167,7 +2167,7 @@ TEST_CASE_METHOD(TApp, "SubcommandCallbackSingle", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmptoml};
|
std::ofstream out{tmptoml};
|
||||||
out << "[foo]" << std::endl;
|
out << "[foo]" << '\n';
|
||||||
}
|
}
|
||||||
int count{0};
|
int count{0};
|
||||||
auto *foo = app.add_subcommand("foo");
|
auto *foo = app.add_subcommand("foo");
|
||||||
@ -2186,8 +2186,8 @@ TEST_CASE_METHOD(TApp, "IniFailure", "[config]") {
|
|||||||
app.allow_config_extras(false);
|
app.allow_config_extras(false);
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_THROWS_AS(run(), CLI::ConfigError);
|
CHECK_THROWS_AS(run(), CLI::ConfigError);
|
||||||
@ -2203,8 +2203,8 @@ TEST_CASE_METHOD(TApp, "IniConfigurable", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -2221,8 +2221,8 @@ TEST_CASE_METHOD(TApp, "IniNotConfigurable", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_THROWS_AS(run(), CLI::ConfigError);
|
CHECK_THROWS_AS(run(), CLI::ConfigError);
|
||||||
@ -2240,8 +2240,8 @@ TEST_CASE_METHOD(TApp, "IniFlagDisableOverrideFlagArray", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=[1,true,false,true]" << std::endl;
|
out << "val=[1,true,false,true]" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -2258,8 +2258,8 @@ TEST_CASE_METHOD(TApp, "IniFlagInvalidDisableOverrideFlagArray", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "val=[1,true,false,not_valid]" << std::endl;
|
out << "val=[1,true,false,not_valid]" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_THROWS_AS(run(), CLI::InvalidError);
|
CHECK_THROWS_AS(run(), CLI::InvalidError);
|
||||||
@ -2274,8 +2274,8 @@ TEST_CASE_METHOD(TApp, "IniSubFailure", "[config]") {
|
|||||||
app.allow_config_extras(false);
|
app.allow_config_extras(false);
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[other]" << std::endl;
|
out << "[other]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_THROWS_AS(run(), CLI::ConfigError);
|
CHECK_THROWS_AS(run(), CLI::ConfigError);
|
||||||
@ -2289,8 +2289,8 @@ TEST_CASE_METHOD(TApp, "IniNoSubFailure", "[config]") {
|
|||||||
app.allow_config_extras(CLI::config_extras_mode::error);
|
app.allow_config_extras(CLI::config_extras_mode::error);
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[other]" << std::endl;
|
out << "[other]" << '\n';
|
||||||
out << "val=1" << std::endl;
|
out << "val=1" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_THROWS_AS(run(), CLI::ConfigError);
|
CHECK_THROWS_AS(run(), CLI::ConfigError);
|
||||||
@ -2305,7 +2305,7 @@ TEST_CASE_METHOD(TApp, "IniFlagConvertFailure", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "flag=moobook" << std::endl;
|
out << "flag=moobook" << '\n';
|
||||||
}
|
}
|
||||||
run();
|
run();
|
||||||
bool result{false};
|
bool result{false};
|
||||||
@ -2326,7 +2326,7 @@ TEST_CASE_METHOD(TApp, "IniFlagNumbers", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "flag=3" << std::endl;
|
out << "flag=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -2344,7 +2344,7 @@ TEST_CASE_METHOD(TApp, "IniFlagDual", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "flag=1 1" << std::endl;
|
out << "flag=1 1" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_THROWS_AS(run(), CLI::ConversionError);
|
CHECK_THROWS_AS(run(), CLI::ConversionError);
|
||||||
@ -2361,7 +2361,7 @@ TEST_CASE_METHOD(TApp, "IniVectorMax", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "vec=[a,b,c]" << std::endl;
|
out << "vec=[a,b,c]" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_THROWS_AS(run(), CLI::ArgumentMismatch);
|
CHECK_THROWS_AS(run(), CLI::ArgumentMismatch);
|
||||||
@ -2377,7 +2377,7 @@ TEST_CASE_METHOD(TApp, "IniShort", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "f=3" << std::endl;
|
out << "f=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -2394,7 +2394,7 @@ TEST_CASE_METHOD(TApp, "IniShortQuote1", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "\"f\"=3" << std::endl;
|
out << "\"f\"=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -2411,7 +2411,7 @@ TEST_CASE_METHOD(TApp, "IniShortQuote2", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "'f'=3" << std::endl;
|
out << "'f'=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -2428,7 +2428,7 @@ TEST_CASE_METHOD(TApp, "IniShortQuote3", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "`f`=3" << std::endl;
|
out << "`f`=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -2445,7 +2445,7 @@ TEST_CASE_METHOD(TApp, "IniDefaultPath", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "f=3" << std::endl;
|
out << "f=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -2464,7 +2464,7 @@ TEST_CASE_METHOD(TApp, "IniMultipleDefaultPath", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "f=3" << std::endl;
|
out << "f=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
args = {"--config", "TestIniTmp.ini"};
|
args = {"--config", "TestIniTmp.ini"};
|
||||||
@ -2484,7 +2484,7 @@ TEST_CASE_METHOD(TApp, "IniMultipleDefaultPathAlternate", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "f=3" << std::endl;
|
out << "f=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
args = {"--config", "TestIniTmp.ini"};
|
args = {"--config", "TestIniTmp.ini"};
|
||||||
@ -2503,7 +2503,7 @@ TEST_CASE_METHOD(TApp, "IniPositional", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "key=3" << std::endl;
|
out << "key=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -2520,7 +2520,7 @@ TEST_CASE_METHOD(TApp, "IniEnvironmental", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "CLI11_TEST_ENV_KEY_TMP=3" << std::endl;
|
out << "CLI11_TEST_ENV_KEY_TMP=3" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_NOTHROW(run());
|
REQUIRE_NOTHROW(run());
|
||||||
@ -2540,10 +2540,10 @@ TEST_CASE_METHOD(TApp, "IniFlagText", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "flag1=true" << std::endl;
|
out << "flag1=true" << '\n';
|
||||||
out << "flag2=on" << std::endl;
|
out << "flag2=on" << '\n';
|
||||||
out << "flag3=off" << std::endl;
|
out << "flag3=off" << '\n';
|
||||||
out << "flag4=1" << std::endl;
|
out << "flag4=1" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
run();
|
run();
|
||||||
@ -2560,11 +2560,11 @@ TEST_CASE_METHOD(TApp, "IniFlags", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=2" << std::endl;
|
out << "two=2" << '\n';
|
||||||
out << "three=true" << std::endl;
|
out << "three=true" << '\n';
|
||||||
out << "four=on" << std::endl;
|
out << "four=on" << '\n';
|
||||||
out << "five" << std::endl;
|
out << "five" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int two{0};
|
int two{0};
|
||||||
@ -2588,12 +2588,12 @@ TEST_CASE_METHOD(TApp, "IniFlagsComment", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=2 # comment 1" << std::endl;
|
out << "two=2 # comment 1" << '\n';
|
||||||
out << "three=true" << std::endl;
|
out << "three=true" << '\n';
|
||||||
out << "four=on #comment 2" << std::endl;
|
out << "four=on #comment 2" << '\n';
|
||||||
out << "five #comment 3" << std::endl;
|
out << "five #comment 3" << '\n';
|
||||||
out << std::endl;
|
out << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int two{0};
|
int two{0};
|
||||||
@ -2617,12 +2617,12 @@ TEST_CASE_METHOD(TApp, "IniFlagsAltComment", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=2 % comment 1" << std::endl;
|
out << "two=2 % comment 1" << '\n';
|
||||||
out << "three=true" << std::endl;
|
out << "three=true" << '\n';
|
||||||
out << "four=on %% comment 2" << std::endl;
|
out << "four=on %% comment 2" << '\n';
|
||||||
out << "five %= 3" << std::endl;
|
out << "five %= 3" << '\n';
|
||||||
out << std::endl;
|
out << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
auto config = app.get_config_formatter_base();
|
auto config = app.get_config_formatter_base();
|
||||||
@ -2648,11 +2648,11 @@ TEST_CASE_METHOD(TApp, "IniFalseFlags", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=-2" << std::endl;
|
out << "two=-2" << '\n';
|
||||||
out << "three=false" << std::endl;
|
out << "three=false" << '\n';
|
||||||
out << "four=1" << std::endl;
|
out << "four=1" << '\n';
|
||||||
out << "five" << std::endl;
|
out << "five" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int two{0};
|
int two{0};
|
||||||
@ -2676,11 +2676,11 @@ TEST_CASE_METHOD(TApp, "IniFalseFlagsDef", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=2" << std::endl;
|
out << "two=2" << '\n';
|
||||||
out << "three=true" << std::endl;
|
out << "three=true" << '\n';
|
||||||
out << "four=on" << std::endl;
|
out << "four=on" << '\n';
|
||||||
out << "five" << std::endl;
|
out << "five" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int two{0};
|
int two{0};
|
||||||
@ -2704,10 +2704,10 @@ TEST_CASE_METHOD(TApp, "IniFalseFlagsDefDisableOverrideError", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=2" << std::endl;
|
out << "two=2" << '\n';
|
||||||
out << "four=on" << std::endl;
|
out << "four=on" << '\n';
|
||||||
out << "five" << std::endl;
|
out << "five" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int two{0};
|
int two{0};
|
||||||
@ -2725,10 +2725,10 @@ TEST_CASE_METHOD(TApp, "IniFalseFlagsDefDisableOverrideSuccess", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=2" << std::endl;
|
out << "two=2" << '\n';
|
||||||
out << "four={}" << std::endl;
|
out << "four={}" << '\n';
|
||||||
out << "val=15" << std::endl;
|
out << "val=15" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int two{0}, four{0}, val{0};
|
int two{0}, four{0}, val{0};
|
||||||
@ -2755,20 +2755,20 @@ TEST_CASE_METHOD(TApp, "IniDisableFlagOverride", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=2" << std::endl;
|
out << "two=2" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini2};
|
std::ofstream out{tmpini2};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "two=7" << std::endl;
|
out << "two=7" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini3};
|
std::ofstream out{tmpini3};
|
||||||
out << "[default]" << std::endl;
|
out << "[default]" << '\n';
|
||||||
out << "three=true" << std::endl;
|
out << "three=true" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int val{0};
|
int val{0};
|
||||||
@ -3284,7 +3284,7 @@ TEST_CASE_METHOD(TApp, "StopReadingConfigOnClear", "[config]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << "volume=1" << std::endl;
|
out << "volume=1" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int volume{0};
|
int volume{0};
|
||||||
@ -3306,7 +3306,7 @@ TEST_CASE_METHOD(TApp, "ConfigWriteReadWrite", "[config]") {
|
|||||||
std::string config1 = app.config_to_str(true, true);
|
std::string config1 = app.config_to_str(true, true);
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << config1 << std::endl;
|
out << config1 << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
app.set_config("--config", tmpini, "Read an ini file", true);
|
app.set_config("--config", tmpini, "Read an ini file", true);
|
||||||
@ -3329,7 +3329,7 @@ TEST_CASE_METHOD(TApp, "ConfigWriteReadNegated", "[config]") {
|
|||||||
std::string config1 = app.config_to_str(false, false);
|
std::string config1 = app.config_to_str(false, false);
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpini};
|
std::ofstream out{tmpini};
|
||||||
out << config1 << std::endl;
|
out << config1 << '\n';
|
||||||
}
|
}
|
||||||
CHECK_FALSE(flag);
|
CHECK_FALSE(flag);
|
||||||
args.clear();
|
args.clear();
|
||||||
|
@ -41,8 +41,10 @@ TEST_CASE("app_fail") {
|
|||||||
try {
|
try {
|
||||||
app->parse(parseData);
|
app->parse(parseData);
|
||||||
} catch(const CLI::ParseError & /*e*/) {
|
} catch(const CLI::ParseError & /*e*/) {
|
||||||
|
CHECK(true);
|
||||||
}
|
}
|
||||||
} catch(const CLI::ConstructionError & /*e*/) {
|
} catch(const CLI::ConstructionError & /*e*/) {
|
||||||
|
CHECK(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,12 +52,13 @@ TEST_CASE("file_fail") {
|
|||||||
CLI::FuzzApp fuzzdata;
|
CLI::FuzzApp fuzzdata;
|
||||||
auto app = fuzzdata.generateApp();
|
auto app = fuzzdata.generateApp();
|
||||||
|
|
||||||
int index = GENERATE(range(1, 7));
|
int index = GENERATE(range(1, 9));
|
||||||
auto parseData = loadFailureFile("fuzz_file_fail", index);
|
auto parseData = loadFailureFile("fuzz_file_fail", index);
|
||||||
std::stringstream out(parseData);
|
std::stringstream out(parseData);
|
||||||
try {
|
try {
|
||||||
app->parse_from_stream(out);
|
app->parse_from_stream(out);
|
||||||
} catch(const CLI::ParseError & /*e*/) {
|
} catch(const CLI::ParseError & /*e*/) {
|
||||||
|
CHECK(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ TEST_CASE("Validators: ProgramNameSplit", "[helpers]") {
|
|||||||
TempFile myfile{"program_name1.exe"};
|
TempFile myfile{"program_name1.exe"};
|
||||||
{
|
{
|
||||||
std::ofstream out{myfile};
|
std::ofstream out{myfile};
|
||||||
out << "useless string doesn't matter" << std::endl;
|
out << "useless string doesn't matter" << '\n';
|
||||||
}
|
}
|
||||||
auto res =
|
auto res =
|
||||||
CLI::detail::split_program_name(std::string("./") + std::string(myfile) + " this is a bunch of extra stuff ");
|
CLI::detail::split_program_name(std::string("./") + std::string(myfile) + " this is a bunch of extra stuff ");
|
||||||
@ -706,7 +706,7 @@ TEST_CASE("Validators: ProgramNameSplit", "[helpers]") {
|
|||||||
TempFile myfile2{"program name1.exe"};
|
TempFile myfile2{"program name1.exe"};
|
||||||
{
|
{
|
||||||
std::ofstream out{myfile2};
|
std::ofstream out{myfile2};
|
||||||
out << "useless string doesn't matter" << std::endl;
|
out << "useless string doesn't matter" << '\n';
|
||||||
}
|
}
|
||||||
res = CLI::detail::split_program_name(std::string(" ") + std::string("./") + std::string(myfile2) +
|
res = CLI::detail::split_program_name(std::string(" ") + std::string("./") + std::string(myfile2) +
|
||||||
" this is a bunch of extra stuff ");
|
" this is a bunch of extra stuff ");
|
||||||
@ -972,7 +972,7 @@ TEST_CASE("AppHelper: Ofstream", "[helpers]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{myfile};
|
std::ofstream out{myfile};
|
||||||
out << "this is output" << std::endl;
|
out << "this is output" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK(CLI::ExistingFile(myfile).empty());
|
CHECK(CLI::ExistingFile(myfile).empty());
|
||||||
|
@ -70,13 +70,11 @@ TEST_CASE_METHOD(TApp, "StdOptionalTest", "[optional]") {
|
|||||||
|
|
||||||
args = {"-c", "1"};
|
args = {"-c", "1"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
CHECK((opt && (1 == *opt)));
|
||||||
CHECK(1 == *opt);
|
|
||||||
|
|
||||||
args = {"--count", "3"};
|
args = {"--count", "3"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
CHECK((opt && (3 == *opt)));
|
||||||
CHECK(3 == *opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE_METHOD(TApp, "StdOptionalVectorEmptyDirect", "[optional]") {
|
TEST_CASE_METHOD(TApp, "StdOptionalVectorEmptyDirect", "[optional]") {
|
||||||
@ -91,7 +89,7 @@ TEST_CASE_METHOD(TApp, "StdOptionalVectorEmptyDirect", "[optional]") {
|
|||||||
CHECK(!opt);
|
CHECK(!opt);
|
||||||
args = {"-v", "1", "4", "5"};
|
args = {"-v", "1", "4", "5"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
std::vector<int> expV{1, 4, 5};
|
std::vector<int> expV{1, 4, 5};
|
||||||
CHECK(expV == *opt);
|
CHECK(expV == *opt);
|
||||||
}
|
}
|
||||||
@ -125,7 +123,7 @@ TEST_CASE_METHOD(TApp, "StdOptionalUint", "[optional]") {
|
|||||||
|
|
||||||
args = {"-i", "15"};
|
args = {"-i", "15"};
|
||||||
run();
|
run();
|
||||||
CHECK(15U == *opt);
|
CHECK((opt && (15U == *opt)));
|
||||||
static_assert(CLI::detail::classify_object<std::optional<std::uint64_t>>::value ==
|
static_assert(CLI::detail::classify_object<std::optional<std::uint64_t>>::value ==
|
||||||
CLI::detail::object_category::wrapper_value);
|
CLI::detail::object_category::wrapper_value);
|
||||||
}
|
}
|
||||||
@ -140,13 +138,14 @@ TEST_CASE_METHOD(TApp, "StdOptionalbool", "[optional]") {
|
|||||||
|
|
||||||
args = {"--opt"};
|
args = {"--opt"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
CHECK((opt && *opt));
|
||||||
CHECK(*opt);
|
|
||||||
|
|
||||||
args = {"--no-opt"};
|
args = {"--no-opt"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
CHECK_FALSE(*opt);
|
if(opt) {
|
||||||
|
CHECK_FALSE(*opt);
|
||||||
|
}
|
||||||
static_assert(CLI::detail::classify_object<std::optional<bool>>::value ==
|
static_assert(CLI::detail::classify_object<std::optional<bool>>::value ==
|
||||||
CLI::detail::object_category::wrapper_value);
|
CLI::detail::object_category::wrapper_value);
|
||||||
}
|
}
|
||||||
@ -186,12 +185,12 @@ TEST_CASE_METHOD(TApp, "BoostOptionalTest", "[optional]") {
|
|||||||
|
|
||||||
args = {"-c", "1"};
|
args = {"-c", "1"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
CHECK(1 == *opt);
|
CHECK(1 == *opt);
|
||||||
opt = {};
|
opt = {};
|
||||||
args = {"--count", "3"};
|
args = {"--count", "3"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
CHECK(3 == *opt);
|
CHECK(3 == *opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +202,7 @@ TEST_CASE_METHOD(TApp, "BoostOptionalTestZarg", "[optional]") {
|
|||||||
|
|
||||||
args = {"-c", "1"};
|
args = {"-c", "1"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
CHECK(1 == *opt);
|
CHECK(1 == *opt);
|
||||||
opt = {};
|
opt = {};
|
||||||
args = {"--count"};
|
args = {"--count"};
|
||||||
@ -219,12 +218,12 @@ TEST_CASE_METHOD(TApp, "BoostOptionalint64Test", "[optional]") {
|
|||||||
|
|
||||||
args = {"-c", "1"};
|
args = {"-c", "1"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
CHECK(1 == *opt);
|
CHECK(1 == *opt);
|
||||||
opt = {};
|
opt = {};
|
||||||
args = {"--count", "3"};
|
args = {"--count", "3"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
CHECK(3 == *opt);
|
CHECK(3 == *opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,12 +235,12 @@ TEST_CASE_METHOD(TApp, "BoostOptionalStringTest", "[optional]") {
|
|||||||
|
|
||||||
args = {"-s", "strval"};
|
args = {"-s", "strval"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
CHECK("strval" == *opt);
|
CHECK("strval" == *opt);
|
||||||
opt = {};
|
opt = {};
|
||||||
args = {"--string", "strv"};
|
args = {"--string", "strv"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
CHECK("strv" == *opt);
|
CHECK("strv" == *opt);
|
||||||
}
|
}
|
||||||
namespace boost {
|
namespace boost {
|
||||||
@ -266,13 +265,13 @@ TEST_CASE_METHOD(TApp, "BoostOptionalEnumTest", "[optional]") {
|
|||||||
args = {"-v", "3"};
|
args = {"-v", "3"};
|
||||||
run();
|
run();
|
||||||
checkOpt = static_cast<bool>(opt);
|
checkOpt = static_cast<bool>(opt);
|
||||||
CHECK(checkOpt);
|
REQUIRE(checkOpt);
|
||||||
CHECK(*opt == eval::val3);
|
CHECK(*opt == eval::val3);
|
||||||
opt = {};
|
opt = {};
|
||||||
args = {"--val", "1"};
|
args = {"--val", "1"};
|
||||||
run();
|
run();
|
||||||
checkOpt = static_cast<bool>(opt);
|
checkOpt = static_cast<bool>(opt);
|
||||||
CHECK(checkOpt);
|
REQUIRE(checkOpt);
|
||||||
CHECK(*opt == eval::val1);
|
CHECK(*opt == eval::val1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +287,7 @@ TEST_CASE_METHOD(TApp, "BoostOptionalVector", "[optional]") {
|
|||||||
args = {"-v", "1", "4", "5"};
|
args = {"-v", "1", "4", "5"};
|
||||||
run();
|
run();
|
||||||
checkOpt = static_cast<bool>(opt);
|
checkOpt = static_cast<bool>(opt);
|
||||||
CHECK(checkOpt);
|
REQUIRE(checkOpt);
|
||||||
std::vector<int> expV{1, 4, 5};
|
std::vector<int> expV{1, 4, 5};
|
||||||
CHECK(expV == *opt);
|
CHECK(expV == *opt);
|
||||||
}
|
}
|
||||||
@ -308,7 +307,7 @@ TEST_CASE_METHOD(TApp, "BoostOptionalVectorEmpty", "[optional]") {
|
|||||||
args = {"-v", "1", "4", "5"};
|
args = {"-v", "1", "4", "5"};
|
||||||
run();
|
run();
|
||||||
checkOpt = static_cast<bool>(opt);
|
checkOpt = static_cast<bool>(opt);
|
||||||
CHECK(checkOpt);
|
REQUIRE(checkOpt);
|
||||||
std::vector<int> expV{1, 4, 5};
|
std::vector<int> expV{1, 4, 5};
|
||||||
CHECK(expV == *opt);
|
CHECK(expV == *opt);
|
||||||
}
|
}
|
||||||
@ -328,7 +327,7 @@ TEST_CASE_METHOD(TApp, "BoostOptionalVectorEmptyDirect", "[optional]") {
|
|||||||
args = {"-v", "1", "4", "5"};
|
args = {"-v", "1", "4", "5"};
|
||||||
run();
|
run();
|
||||||
checkOpt = static_cast<bool>(opt);
|
checkOpt = static_cast<bool>(opt);
|
||||||
CHECK(checkOpt);
|
REQUIRE(checkOpt);
|
||||||
std::vector<int> expV{1, 4, 5};
|
std::vector<int> expV{1, 4, 5};
|
||||||
CHECK(expV == *opt);
|
CHECK(expV == *opt);
|
||||||
}
|
}
|
||||||
@ -344,12 +343,12 @@ TEST_CASE_METHOD(TApp, "BoostOptionalComplexDirect", "[optional]") {
|
|||||||
CHECK(!opt);
|
CHECK(!opt);
|
||||||
args = {"-c", "1+2j"};
|
args = {"-c", "1+2j"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
std::complex<double> val{1, 2};
|
std::complex<double> val{1, 2};
|
||||||
CHECK(val == *opt);
|
CHECK(val == *opt);
|
||||||
args = {"-c", "3", "-4"};
|
args = {"-c", "3", "-4"};
|
||||||
run();
|
run();
|
||||||
CHECK(opt);
|
REQUIRE(opt);
|
||||||
std::complex<double> val2{3, -4};
|
std::complex<double> val2{3, -4};
|
||||||
CHECK(val2 == *opt);
|
CHECK(val2 == *opt);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ TEST_CASE_METHOD(TApp, "ExistingExeCheck", "[stringparse]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpexe};
|
std::ofstream out{tmpexe};
|
||||||
out << "useless string doesn't matter" << std::endl;
|
out << "useless string doesn't matter" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
app.parse(std::string("./") + std::string(tmpexe) +
|
app.parse(std::string("./") + std::string(tmpexe) +
|
||||||
@ -42,7 +42,7 @@ TEST_CASE_METHOD(TApp, "ExistingExeCheckWithSpace", "[stringparse]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpexe};
|
std::ofstream out{tmpexe};
|
||||||
out << "useless string doesn't matter" << std::endl;
|
out << "useless string doesn't matter" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
app.parse(std::string("./") + std::string(tmpexe) +
|
app.parse(std::string("./") + std::string(tmpexe) +
|
||||||
@ -66,7 +66,7 @@ TEST_CASE_METHOD(TApp, "ExistingExeCheckWithLotsOfSpace", "[stringparse]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ofstream out{tmpexe};
|
std::ofstream out{tmpexe};
|
||||||
out << "useless string doesn't matter" << std::endl;
|
out << "useless string doesn't matter" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
app.parse(std::string("./") + std::string(tmpexe) +
|
app.parse(std::string("./") + std::string(tmpexe) +
|
||||||
|
@ -63,6 +63,6 @@ TEST_CASE("Timer: PrintTimer", "[timer]") {
|
|||||||
TEST_CASE("Timer: TimeItTimer", "[timer]") {
|
TEST_CASE("Timer: TimeItTimer", "[timer]") {
|
||||||
CLI::Timer timer;
|
CLI::Timer timer;
|
||||||
std::string output = timer.time_it([]() { std::this_thread::sleep_for(std::chrono::milliseconds(10)); }, .1);
|
std::string output = timer.time_it([]() { std::this_thread::sleep_for(std::chrono::milliseconds(10)); }, .1);
|
||||||
std::cout << output << std::endl;
|
std::cout << output << '\n';
|
||||||
CHECK_THAT(output, Contains("ms"));
|
CHECK_THAT(output, Contains("ms"));
|
||||||
}
|
}
|
||||||
|
1
tests/fuzzFail/fuzz_file_fail7
Normal file
1
tests/fuzzFail/fuzz_file_fail7
Normal file
@ -0,0 +1 @@
|
|||||||
|
--vdtr5=[|
|
1
tests/fuzzFail/fuzz_file_fail8
Normal file
1
tests/fuzzFail/fuzz_file_fail8
Normal file
@ -0,0 +1 @@
|
|||||||
|
[ÏqÏq[]1."È"\".saopt1[[]1."È"\".saopt1[]
|
@ -52,5 +52,5 @@ int main() {
|
|||||||
std::cout << " boost::optional support active\n";
|
std::cout << " boost::optional support active\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::cout << std::endl;
|
std::cout << '\n';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user