diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2018-02-26 06:08:51 -0800 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-02-26 06:08:51 -0800 |
| commit | 71d44cebdb85926bc00241fc08f0dcaaedb868d2 (patch) | |
| tree | 0d6b17e9666f535d604cf968b5353f326189352c | |
| parent | 2e135bf09677163fc20364f9d46ba4248042ae1a (diff) | |
| download | vcpkg-71d44cebdb85926bc00241fc08f0dcaaedb868d2.tar.gz vcpkg-71d44cebdb85926bc00241fc08f0dcaaedb868d2.zip | |
[vcpkg] Add test for default-features with a preinstalled dependency
| -rw-r--r-- | toolsrc/src/tests.plan.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/toolsrc/src/tests.plan.cpp b/toolsrc/src/tests.plan.cpp index d33ab290d..2bdb4a465 100644 --- a/toolsrc/src/tests.plan.cpp +++ b/toolsrc/src/tests.plan.cpp @@ -536,8 +536,34 @@ namespace UnitTest1 // Expect "a" to get installed and defaults of "b" through the dependency, // as no explicit features of "b" are installed by the user. Assert::IsTrue(install_plan.size() == 2); - features_check(&install_plan[1], "a", {"core"}, Triplet::X64_WINDOWS); features_check(&install_plan[0], "b", {"b1", "core"}, Triplet::X64_WINDOWS); + features_check(&install_plan[1], "a", {"core"}, Triplet::X64_WINDOWS); + } + + TEST_METHOD(do_not_install_default_features_of_existing_dependency) + { + // Add a port "a" which depends on the core of "b" + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + spec_map.emplace("a", "b[core]"); + // "b" has two features, of which "b1" is default. + spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); + + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + // "b[core]" is already installed + status_paragraphs.push_back(make_status_pgh("b")); + status_paragraphs.back()->package.spec = + PackageSpec::from_name_and_triplet("b", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); + + // Install "a" (without explicit feature specification) + auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + // Expect "a" to get installed, but not require rebuilding "b" + Assert::IsTrue(install_plan.size() == 1); + features_check(&install_plan[0], "a", {"core"}, Triplet::X64_WINDOWS); } TEST_METHOD(install_default_features_of_dependency_test_2) |
