diff options
| author | Jonathan Hale <Squareys@googlemail.com> | 2018-02-15 01:18:25 +0100 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-02-14 16:18:25 -0800 |
| commit | 425d07ef7f82541e50cc8cb1e2716fc33bba7b12 (patch) | |
| tree | e73f3675b5fe95f0dc61521a2a7457a6e5c08d53 /toolsrc/src/tests.paragraph.cpp | |
| parent | 50a545fcff4b3c922aa3ef5d0646dc9850f1bb86 (diff) | |
| download | vcpkg-425d07ef7f82541e50cc8cb1e2716fc33bba7b12.tar.gz vcpkg-425d07ef7f82541e50cc8cb1e2716fc33bba7b12.zip | |
[vcpkg] Implement Default-Features (#2697)
* [vcpkg] Add Default-Feature to make_status_pgh utility function
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Parse "Default-Features" as dependencies and add test for parsing
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Document some methods and structures
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Add install_default_features_test
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Change install_default_features_test to not have preinstalled package
* [vcpkg] Test install behaviour of default features
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Implement default features
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Test default features upgrade behavior
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Implement upgrade with default features
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Test behaviour of upgrade with default features in dependencies
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Make upgrade install new default features
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Move collecting of packages for which to prevent defaults
Further down the line to create_feature_install_plan.
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Fix core missing from default features and potential inf loop
Signed-off-by: Squareys <squareys@googlemail.com>
* [vcpkg] Rename, fix and move some tests
Signed-off-by: Squareys <squareys@googlemail.com>
Diffstat (limited to 'toolsrc/src/tests.paragraph.cpp')
| -rw-r--r-- | toolsrc/src/tests.paragraph.cpp | 35 |
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 = ""; |
