From 0ca8a43ebd4ee8c10918c4ea92c297ee715b4d77 Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Wed, 15 Mar 2017 08:29:26 -0400 Subject: [PATCH] Better ini config behavour with one quote --- include/CLI/StringTools.hpp | 4 ++-- tests/HelpersTest.cpp | 4 ++-- tests/IniTest.cpp | 5 ----- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/CLI/StringTools.hpp b/include/CLI/StringTools.hpp index f1aa04b5..25320160 100644 --- a/include/CLI/StringTools.hpp +++ b/include/CLI/StringTools.hpp @@ -167,7 +167,7 @@ std::vector inline split_up(std::string str) { output.push_back(str.substr(1,end-1)); str = str.substr(end+1); } else { - output.push_back(str); + output.push_back(str.substr(1)); str = ""; } } else if(str[0] == '\"') { @@ -176,7 +176,7 @@ std::vector inline split_up(std::string str) { output.push_back(str.substr(1,end-1)); str = str.substr(end+1); } else { - output.push_back(str); + output.push_back(str.substr(1)); str = ""; } diff --git a/tests/HelpersTest.cpp b/tests/HelpersTest.cpp index 6c067f3f..b9ae91cd 100644 --- a/tests/HelpersTest.cpp +++ b/tests/HelpersTest.cpp @@ -298,12 +298,12 @@ TEST(SplitUp, Spaces) { } TEST(SplitUp, BadStrings) { - std::vector oput = {"one", "\" two three"}; + std::vector oput = {"one", " two three"}; std::string orig {" one \" two three "}; std::vector result = CLI::detail::split_up(orig); EXPECT_EQ(oput, result); - oput = {"one", "\' two three"}; + oput = {"one", " two three"}; orig = " one \' two three "; result = CLI::detail::split_up(orig); EXPECT_EQ(oput, result); diff --git a/tests/IniTest.cpp b/tests/IniTest.cpp index 16c532f5..38835865 100644 --- a/tests/IniTest.cpp +++ b/tests/IniTest.cpp @@ -331,8 +331,3 @@ TEST_F(TApp, IniOutputFlag) { EXPECT_THAT(str, Not(HasSubstr("nothing="))); } - -TEST_F(TApp, IniSpaces) { - - -}