From af6bbc1d4719f28b2ce65bf26a54ef5e9cd4096a Mon Sep 17 00:00:00 2001 From: Sean Robinson Date: Tue, 26 Oct 2021 12:58:24 -0700 Subject: [PATCH 1/2] Skip --version test until it can be made to work Because program.parse_args( { "test", "--version" }) calls std::exit(0), the REQUIRE line never runs and this test is less useful. Because tests execution stops here, the doctest status report is not output. If --version can be made to not exit during this test, then the test could be restored. Signed-off-by: Sean Robinson --- test/test_version.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_version.cpp b/test/test_version.cpp index 103f96df..4f5487a7 100644 --- a/test/test_version.cpp +++ b/test/test_version.cpp @@ -3,7 +3,8 @@ using doctest::test_suite; -TEST_CASE("Users can print version and exit" * test_suite("version")) { +TEST_CASE("Users can print version and exit" * test_suite("version") + * doctest::skip()) { argparse::ArgumentParser program("cli-test", "1.9.0"); program.add_argument("-d", "--dir") .required(); From 500bc9277e289c1e4b609e77923fa88a64f62406 Mon Sep 17 00:00:00 2001 From: Sean Robinson Date: Wed, 27 Oct 2021 07:24:45 -0700 Subject: [PATCH 2/2] Add ArgumentParser::mIsParsed to copied members MSVC 19.16 appears to be doing a copy rather than a move in test_const_correct. The copy ctor does not handle mIsParsed, so the initial false value is kept. This commit adds copying mIsParsed during copy construction. Signed-off-by: Sean Robinson --- include/argparse/argparse.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/argparse/argparse.hpp b/include/argparse/argparse.hpp index cb427cd7..75437f80 100644 --- a/include/argparse/argparse.hpp +++ b/include/argparse/argparse.hpp @@ -830,6 +830,7 @@ class ArgumentParser { ArgumentParser(const ArgumentParser &other) : mProgramName(other.mProgramName), + mIsParsed(other.mIsParsed), mPositionalArguments(other.mPositionalArguments), mOptionalArguments(other.mOptionalArguments) { for (auto it = std::begin(mPositionalArguments); it != std::end(mPositionalArguments);