diff options
| author | Mikhaylov Anton <anion155@gmail.com> | 2020-02-04 13:40:15 +0500 |
|---|---|---|
| committer | Mikhaylov Anton <anion155@gmail.com> | 2020-02-04 13:40:15 +0500 |
| commit | d56ed7ee7613e969a3f304b3377438cc5a9064d4 (patch) | |
| tree | d352eee837443f070bbf5d6c5fdd9a6f22f4f8c2 /toolsrc/src/vcpkg-test/paragraph.cpp | |
| parent | ab5b74c797f5a2bd6b28915908355e2b32876dfa (diff) | |
| parent | 85bf9d9d792e379e973d66c8af9f39d65d1d6d42 (diff) | |
| download | vcpkg-d56ed7ee7613e969a3f304b3377438cc5a9064d4.tar.gz vcpkg-d56ed7ee7613e969a3f304b3377438cc5a9064d4.zip | |
Merge branch 'master' into patch-1
Diffstat (limited to 'toolsrc/src/vcpkg-test/paragraph.cpp')
| -rw-r--r-- | toolsrc/src/vcpkg-test/paragraph.cpp | 96 |
1 files changed, 42 insertions, 54 deletions
diff --git a/toolsrc/src/vcpkg-test/paragraph.cpp b/toolsrc/src/vcpkg-test/paragraph.cpp index 85c37851d..2ee4efe2f 100644 --- a/toolsrc/src/vcpkg-test/paragraph.cpp +++ b/toolsrc/src/vcpkg-test/paragraph.cpp @@ -10,10 +10,11 @@ namespace Strings = vcpkg::Strings; TEST_CASE ("SourceParagraph construct minimum", "[paragraph]") { auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, - {"Version", "1.2.8"}, - }}); + vcpkg::SourceControlFile::parse_control_file("", + std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "zlib"}, + {"Version", "1.2.8"}, + }}); REQUIRE(m_pgh.has_value()); auto& pgh = **m_pgh.get(); @@ -28,15 +29,15 @@ TEST_CASE ("SourceParagraph construct minimum", "[paragraph]") TEST_CASE ("SourceParagraph construct maximum", "[paragraph]") { auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "s"}, - {"Version", "v"}, - {"Maintainer", "m"}, - {"Description", "d"}, - {"Build-Depends", "bd"}, - {"Default-Features", "df"}, - {"Supports", "x64"}, - }}); + vcpkg::SourceControlFile::parse_control_file("", + std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "s"}, + {"Version", "v"}, + {"Maintainer", "m"}, + {"Description", "d"}, + {"Build-Depends", "bd"}, + {"Default-Features", "df"}, + }}); REQUIRE(m_pgh.has_value()); auto& pgh = **m_pgh.get(); @@ -48,18 +49,17 @@ TEST_CASE ("SourceParagraph construct maximum", "[paragraph]") REQUIRE(pgh.core_paragraph->depends[0].name() == "bd"); REQUIRE(pgh.core_paragraph->default_features.size() == 1); REQUIRE(pgh.core_paragraph->default_features[0] == "df"); - REQUIRE(pgh.core_paragraph->supports.size() == 1); - REQUIRE(pgh.core_paragraph->supports[0] == "x64"); } TEST_CASE ("SourceParagraph two depends", "[paragraph]") { auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, - {"Version", "1.2.8"}, - {"Build-Depends", "z, openssl"}, - }}); + vcpkg::SourceControlFile::parse_control_file("", + std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Build-Depends", "z, openssl"}, + }}); REQUIRE(m_pgh.has_value()); auto& pgh = **m_pgh.get(); @@ -71,11 +71,12 @@ TEST_CASE ("SourceParagraph two depends", "[paragraph]") TEST_CASE ("SourceParagraph three depends", "[paragraph]") { auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, - {"Version", "1.2.8"}, - {"Build-Depends", "z, openssl, xyz"}, - }}); + vcpkg::SourceControlFile::parse_control_file("", + std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Build-Depends", "z, openssl, xyz"}, + }}); REQUIRE(m_pgh.has_value()); auto& pgh = **m_pgh.get(); @@ -85,31 +86,15 @@ TEST_CASE ("SourceParagraph three depends", "[paragraph]") REQUIRE(pgh.core_paragraph->depends[2].name() == "xyz"); } -TEST_CASE ("SourceParagraph three supports", "[paragraph]") -{ - auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, - {"Version", "1.2.8"}, - {"Supports", "x64, windows, uwp"}, - }}); - REQUIRE(m_pgh.has_value()); - auto& pgh = **m_pgh.get(); - - REQUIRE(pgh.core_paragraph->supports.size() == 3); - REQUIRE(pgh.core_paragraph->supports[0] == "x64"); - REQUIRE(pgh.core_paragraph->supports[1] == "windows"); - REQUIRE(pgh.core_paragraph->supports[2] == "uwp"); -} - TEST_CASE ("SourceParagraph construct qualified depends", "[paragraph]") { auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, - {"Version", "1.2.8"}, - {"Build-Depends", "libA (windows), libB (uwp)"}, - }}); + vcpkg::SourceControlFile::parse_control_file("", + std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Build-Depends", "libA (windows), libB (uwp)"}, + }}); REQUIRE(m_pgh.has_value()); auto& pgh = **m_pgh.get(); @@ -127,11 +112,12 @@ TEST_CASE ("SourceParagraph construct qualified depends", "[paragraph]") TEST_CASE ("SourceParagraph default features", "[paragraph]") { 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"}, - }}); + vcpkg::SourceControlFile::parse_control_file("", + std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "a"}, + {"Version", "1.0"}, + {"Default-Features", "a1"}, + }}); REQUIRE(m_pgh.has_value()); auto& pgh = **m_pgh.get(); @@ -380,11 +366,12 @@ TEST_CASE ("BinaryParagraph serialize min", "[paragraph]") auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); REQUIRE(pghs.size() == 1); - REQUIRE(pghs[0].size() == 4); + REQUIRE(pghs[0].size() == 5); REQUIRE(pghs[0]["Package"] == "zlib"); REQUIRE(pghs[0]["Version"] == "1.2.8"); REQUIRE(pghs[0]["Architecture"] == "x86-windows"); REQUIRE(pghs[0]["Multi-Arch"] == "same"); + REQUIRE(pghs[0]["Type"] == "Port"); } TEST_CASE ("BinaryParagraph serialize max", "[paragraph]") @@ -402,13 +389,14 @@ TEST_CASE ("BinaryParagraph serialize max", "[paragraph]") auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); REQUIRE(pghs.size() == 1); - REQUIRE(pghs[0].size() == 7); + REQUIRE(pghs[0].size() == 8); REQUIRE(pghs[0]["Package"] == "zlib"); REQUIRE(pghs[0]["Version"] == "1.2.8"); REQUIRE(pghs[0]["Architecture"] == "x86-windows"); REQUIRE(pghs[0]["Multi-Arch"] == "same"); REQUIRE(pghs[0]["Description"] == "first line\n second line"); REQUIRE(pghs[0]["Depends"] == "dep"); + REQUIRE(pghs[0]["Type"] == "Port"); } TEST_CASE ("BinaryParagraph serialize multiple deps", "[paragraph]") |
