aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/tests_dependencies.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2016-11-05 01:02:15 -0700
committerRobert Schumacher <roschuma@microsoft.com>2016-11-05 01:02:15 -0700
commit7f336c746776daf2af95914ed25ff3d50a96b387 (patch)
tree2251824d5db437212c34dd80229e8241964dd774 /toolsrc/src/tests_dependencies.cpp
parente5152851f2bb070eb4bcc2b8968d40d48226b04e (diff)
downloadvcpkg-7f336c746776daf2af95914ed25ff3d50a96b387.tar.gz
vcpkg-7f336c746776daf2af95914ed25ff3d50a96b387.zip
Enable qualified dependencies. Fix bug in internal 'build' command.
Added capability for CONTROL files to specify qualified dependencies, which are substring searched inside triplet names. Fixed bug in internal 'build' command where if a package is already built, that built package's dependencies will be used to determine requirements for the build instead of the port directory's CONTROL file.
Diffstat (limited to 'toolsrc/src/tests_dependencies.cpp')
-rw-r--r--toolsrc/src/tests_dependencies.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/toolsrc/src/tests_dependencies.cpp b/toolsrc/src/tests_dependencies.cpp
new file mode 100644
index 000000000..bce1cab0e
--- /dev/null
+++ b/toolsrc/src/tests_dependencies.cpp
@@ -0,0 +1,39 @@
+#include "CppUnitTest.h"
+#include "SourceParagraph.h"
+#include "triplet.h"
+
+#pragma comment(lib,"version")
+#pragma comment(lib,"winhttp")
+
+using namespace Microsoft::VisualStudio::CppUnitTestFramework;
+
+using namespace vcpkg;
+
+namespace UnitTest1
+{
+ TEST_CLASS(DependencyTests)
+ {
+ public:
+ TEST_METHOD(parse_depends_one)
+ {
+ auto v = expand_qualified_dependencies(parse_depends("libA [windows]"));
+ Assert::AreEqual(size_t(1), v.size());
+ Assert::AreEqual("libA", v[0].name.c_str());
+ Assert::AreEqual("windows", v[0].qualifier.c_str());
+ }
+
+ TEST_METHOD(filter_depends)
+ {
+ auto deps = expand_qualified_dependencies(parse_depends("libA [windows], libB, libC [uwp]"));
+ auto v = filter_dependencies(deps, triplet::X64_WINDOWS);
+ Assert::AreEqual(size_t(2), v.size());
+ Assert::AreEqual("libA", v[0].c_str());
+ Assert::AreEqual("libB", v[1].c_str());
+
+ auto v2 = filter_dependencies(deps, triplet::ARM_UWP);
+ Assert::AreEqual(size_t(2), v.size());
+ Assert::AreEqual("libB", v2[0].c_str());
+ Assert::AreEqual("libC", v2[1].c_str());
+ }
+ };
+}