Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57829 - in trunk/libs/program_options: src test
From: s.ochsenknecht_at_[hidden]
Date: 2009-11-21 02:59:42


Author: s_ochsenknecht
Date: 2009-11-21 02:59:41 EST (Sat, 21 Nov 2009)
New Revision: 57829
URL: http://svn.boost.org/trac/boost/changeset/57829

Log:
store empty values from config file, Fixes #1537
Text files modified:
   trunk/libs/program_options/src/config_file.cpp | 3 ---
   trunk/libs/program_options/test/parsers_test.cpp | 11 ++++++-----
   2 files changed, 6 insertions(+), 8 deletions(-)

Modified: trunk/libs/program_options/src/config_file.cpp
==============================================================================
--- trunk/libs/program_options/src/config_file.cpp (original)
+++ trunk/libs/program_options/src/config_file.cpp 2009-11-21 02:59:41 EST (Sat, 21 Nov 2009)
@@ -105,9 +105,6 @@
                     bool registered = allowed_option(name);
                     if (!registered && !m_allow_unregistered)
                         boost::throw_exception(unknown_option(name));
-
- if (value.empty())
- continue;
 
                     found = true;
                     this->value().string_key = name;

Modified: trunk/libs/program_options/test/parsers_test.cpp
==============================================================================
--- trunk/libs/program_options/test/parsers_test.cpp (original)
+++ trunk/libs/program_options/test/parsers_test.cpp 2009-11-21 02:59:41 EST (Sat, 21 Nov 2009)
@@ -222,12 +222,13 @@
 
     stringstream ss(content1);
     vector<option> a1 = parse_config_file(ss, desc).options;
- BOOST_REQUIRE(a1.size() == 5);
+ BOOST_REQUIRE(a1.size() == 6);
     check_value(a1[0], "gv1", "0");
- check_value(a1[1], "plug3", "7");
- check_value(a1[2], "b", "true");
- check_value(a1[3], "m1.v1", "1");
- check_value(a1[4], "m1.v2", "2");
+ check_value(a1[1], "empty_value", "");
+ check_value(a1[2], "plug3", "7");
+ check_value(a1[3], "b", "true");
+ check_value(a1[4], "m1.v1", "1");
+ check_value(a1[5], "m1.v2", "2");
 
 }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk