aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/tests.paragraph.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/src/tests.paragraph.cpp')
-rw-r--r--toolsrc/src/tests.paragraph.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/toolsrc/src/tests.paragraph.cpp b/toolsrc/src/tests.paragraph.cpp
index 9cddd7bdb..dca89bc59 100644
--- a/toolsrc/src/tests.paragraph.cpp
+++ b/toolsrc/src/tests.paragraph.cpp
@@ -1,4 +1,4 @@
-#include "tests.pch.h"
+#include "tests.pch.h"
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")
@@ -47,6 +47,7 @@ namespace UnitTest1
{"Maintainer", "m"},
{"Description", "d"},
{"Build-Depends", "bd"},
+ {"Default-Features", "df"},
{"Supports", "x64"},
}});
Assert::IsTrue(m_pgh.has_value());
@@ -58,6 +59,8 @@ namespace UnitTest1
Assert::AreEqual("d", pgh->core_paragraph->description.c_str());
Assert::AreEqual(size_t(1), pgh->core_paragraph->depends.size());
Assert::AreEqual("bd", pgh->core_paragraph->depends[0].name().c_str());
+ Assert::AreEqual(size_t(1), pgh->core_paragraph->default_features.size());
+ Assert::AreEqual("df", pgh->core_paragraph->default_features[0].c_str());
Assert::AreEqual(size_t(1), pgh->core_paragraph->supports.size());
Assert::AreEqual("x64", pgh->core_paragraph->supports[0].c_str());
}
@@ -134,6 +137,21 @@ namespace UnitTest1
Assert::AreEqual("uwp", pgh->core_paragraph->depends[1].qualifier.c_str());
}
+ TEST_METHOD(SourceParagraph_Default_Features)
+ {
+ auto m_pgh =
+ vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{
+ {"Source", "a"},
+ {"Version", "1.0"},
+ {"Default-Features", "a1"},
+ }});
+ Assert::IsTrue(m_pgh.has_value());
+ auto& pgh = *m_pgh.get();
+
+ Assert::AreEqual(size_t(1), pgh->core_paragraph->default_features.size());
+ Assert::AreEqual("a1", pgh->core_paragraph->default_features[0].c_str());
+ }
+
TEST_METHOD(BinaryParagraph_Construct_Minimum)
{
vcpkg::BinaryParagraph pgh({
@@ -200,6 +218,21 @@ namespace UnitTest1
Assert::IsTrue(pgh.abi == "abcd123");
}
+ TEST_METHOD(BinaryParagraph_Default_Features)
+ {
+ vcpkg::BinaryParagraph pgh({
+ {"Package", "a"},
+ {"Version", "1.0"},
+ {"Architecture", "x86-windows"},
+ {"Multi-Arch", "same"},
+ {"Default-Features", "a1"},
+ });
+
+ Assert::AreEqual(size_t(0), pgh.depends.size());
+ Assert::AreEqual(size_t(1), pgh.default_features.size());
+ Assert::IsTrue(pgh.default_features[0] == "a1");
+ }
+
TEST_METHOD(parse_paragraphs_empty)
{
const char* str = "";