aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/Paragraphs.cpp2
-rw-r--r--toolsrc/src/tests_paragraph.cpp10
2 files changed, 11 insertions, 1 deletions
diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp
index 98eb64328..010da6700 100644
--- a/toolsrc/src/Paragraphs.cpp
+++ b/toolsrc/src/Paragraphs.cpp
@@ -34,7 +34,7 @@ namespace vcpkg::Paragraphs
void skip_comment(char& ch)
{
- while (ch != '\r')
+ while (ch != '\r' && ch != '\n' && ch != '\0')
next(ch);
if (ch == '\r')
next(ch);
diff --git a/toolsrc/src/tests_paragraph.cpp b/toolsrc/src/tests_paragraph.cpp
index ba972f437..10a84b703 100644
--- a/toolsrc/src/tests_paragraph.cpp
+++ b/toolsrc/src/tests_paragraph.cpp
@@ -289,6 +289,16 @@ namespace UnitTest1
Assert::AreEqual("v4", pghs[1]["f4"].c_str());
}
+ TEST_METHOD(parse_comment_before_single_slashN)
+ {
+ const char* str =
+ "f1: v1\r\n"
+ "#comment\n";
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO);
+ Assert::AreEqual(size_t(1), pghs[0].size());
+ Assert::AreEqual("v1", pghs[0]["f1"].c_str());
+ }
+
TEST_METHOD(BinaryParagraph_serialize_min)
{
std::stringstream ss;