aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg-test/paragraph.cpp
diff options
context:
space:
mode:
authorVictor Romero <romerosanchezv@gmail.com>2020-10-26 10:24:30 -0700
committerGitHub <noreply@github.com>2020-10-26 10:24:30 -0700
commite9f8cc67a5e5541973e53ac03f88adb45cc1b21b (patch)
treeb123780ce6a6d738a6bdb40e588eb4579c3074d9 /toolsrc/src/vcpkg-test/paragraph.cpp
parentac2ddd5f059b56b6e0b9fc0c73bd4feccad539ff (diff)
downloadvcpkg-e9f8cc67a5e5541973e53ac03f88adb45cc1b21b.tar.gz
vcpkg-e9f8cc67a5e5541973e53ac03f88adb45cc1b21b.zip
[vcpkg] Implement versions db generator (#13777)
* [vcpkg] Add script to generate ports versions history * [vcpkg] Fix formatting * Fetch port versions from commit ID * Use global --x-json switch * Use --no-checkout when cloning secondary instance * Clone from local repository instead of from GitHub * Use CmdLineBuilder to build git commands * Use CmdLineBuilder and reduce repeated code * Fetch version at baseline and code cleanup * Guess version scheme from old CONTROL files * Rename version db generator script * Simplify x-history json output * Use CONTROL/manifest parsers on x-history * Use git-tree instaed of commit-id * Remove 'ports' field from root object * Clean up code * More code cleanup * Improve port version detection * Improve generator logging * Do not ignore parsing errors in CONTROL files * PR review comments in Python script * Fix subprocess.run() calls * Make `canonicalize()` return error instead of terminating * [vcpkg] Add tests for new test_parse_control_file paths * Remove unnecessary std::move() calls * Fix formatting * Python formatting Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Diffstat (limited to 'toolsrc/src/vcpkg-test/paragraph.cpp')
-rw-r--r--toolsrc/src/vcpkg-test/paragraph.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/toolsrc/src/vcpkg-test/paragraph.cpp b/toolsrc/src/vcpkg-test/paragraph.cpp
index 05ba8cfba..356ee88f8 100644
--- a/toolsrc/src/vcpkg-test/paragraph.cpp
+++ b/toolsrc/src/vcpkg-test/paragraph.cpp
@@ -51,6 +51,38 @@ TEST_CASE ("SourceParagraph construct minimum", "[paragraph]")
REQUIRE(pgh.core_paragraph->dependencies.size() == 0);
}
+TEST_CASE ("SourceParagraph construct invalid", "[paragraph]")
+{
+ auto m_pgh = test_parse_control_file({{
+ {"Source", "zlib"},
+ {"Version", "1.2.8"},
+ {"Build-Depends", "1.2.8"},
+ }});
+
+ REQUIRE(!m_pgh.has_value());
+
+ m_pgh = test_parse_control_file({{
+ {"Source", "zlib"},
+ {"Version", "1.2.8"},
+ {"Default-Features", "1.2.8"},
+ }});
+
+ REQUIRE(!m_pgh.has_value());
+
+ m_pgh = test_parse_control_file({
+ {
+ {"Source", "zlib"},
+ {"Version", "1.2.8"},
+ },
+ {
+ {"Feature", "a"},
+ {"Build-Depends", "1.2.8"},
+ },
+ });
+
+ REQUIRE(!m_pgh.has_value());
+}
+
TEST_CASE ("SourceParagraph construct maximum", "[paragraph]")
{
auto m_pgh = test_parse_control_file({{
@@ -76,6 +108,24 @@ TEST_CASE ("SourceParagraph construct maximum", "[paragraph]")
REQUIRE(pgh.core_paragraph->default_features[0] == "df");
}
+TEST_CASE ("SourceParagraph construct feature", "[paragraph]")
+{
+ auto m_pgh = test_parse_control_file({
+ {
+ {"Source", "s"},
+ {"Version", "v"},
+ },
+ {{"Feature", "f"}, {"Description", "d2"}, {"Build-Depends", "bd2"}},
+ });
+ REQUIRE(m_pgh.has_value());
+ auto& pgh = **m_pgh.get();
+
+ REQUIRE(pgh.feature_paragraphs.size() == 1);
+ REQUIRE(pgh.feature_paragraphs[0]->name == "f");
+ REQUIRE(pgh.feature_paragraphs[0]->description == std::vector<std::string>{"d2"});
+ REQUIRE(pgh.feature_paragraphs[0]->dependencies.size() == 1);
+}
+
TEST_CASE ("SourceParagraph two dependencies", "[paragraph]")
{
auto m_pgh = test_parse_control_file({{