From 5a782e87265b6faadb00b0de79c32234cab63a1c Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Thu, 28 May 2020 15:02:51 +0200 Subject: [PATCH] Add a test for unregisted options --- test/properties/_properties.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/properties/_properties.cxx b/test/properties/_properties.cxx index 54c8315d..1323465c 100644 --- a/test/properties/_properties.cxx +++ b/test/properties/_properties.cxx @@ -70,6 +70,9 @@ TEST(ProgOptions, SetAndGet) set_and_get>(o, "_vector", { 33.22, 33.23, 33.24 }); set_and_get>(o, "_vector", { 333.222, 333.223, 333.224 }); set_and_get>(o, "_vector", { boost::filesystem::path("C:\\Windows"), boost::filesystem::path("C:\\Windows\\System32") }); + + ASSERT_THROW(o.ParseAll({"cmd", "--unregistered", "option"}, false), boost::program_options::unknown_option); + ASSERT_NO_THROW(o.ParseAll({"cmd", "--unregistered", "option"}, true)); } template