aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/tests_paragraph.cpp
diff options
context:
space:
mode:
authorsdcb <sdflysha@qq.com>2017-04-05 17:12:32 +0800
committersdcb <sdflysha@qq.com>2017-04-05 17:12:32 +0800
commit928ff24cbca717ac9b39589874b6e8ec17c236b8 (patch)
treeb79678aae1a631389365c3b74c6785bc75233d72 /toolsrc/src/tests_paragraph.cpp
parentd9a403453904261c6b34c5d33557134b9fe3a8a0 (diff)
downloadvcpkg-928ff24cbca717ac9b39589874b6e8ec17c236b8.tar.gz
vcpkg-928ff24cbca717ac9b39589874b6e8ec17c236b8.zip
Fix a infinite skip_comment check in Paragraphs.cpp
This happens when git not checkout file's line break as CR-LF. When CONTROL file contains comment followed by \n instead of \r\n, there will be a infinite skip_comment check.
Diffstat (limited to 'toolsrc/src/tests_paragraph.cpp')
-rw-r--r--toolsrc/src/tests_paragraph.cpp10
1 files changed, 10 insertions, 0 deletions
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;