aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg-test/platform-expression.cpp
diff options
context:
space:
mode:
authorBilly O'Neal <bion@microsoft.com>2021-02-04 10:15:44 -0800
committerGitHub <noreply@github.com>2021-02-04 10:15:44 -0800
commitaa60b7efa56a83ead743718941d8b320ef4a05af (patch)
treedb9f9ebd6fa37598b2f5f2ad564eb858cdeddcb0 /toolsrc/src/vcpkg-test/platform-expression.cpp
parentf226416d2eafc495dd03572cb61542fb1670ffdc (diff)
downloadvcpkg-aa60b7efa56a83ead743718941d8b320ef4a05af.tar.gz
vcpkg-aa60b7efa56a83ead743718941d8b320ef4a05af.zip
[vcpkg] Download vcpkg.exe rather than building it in bootstrap on Windows. (#15474)
This reduces bootstrap cost for Windows customers, resolving the issue initially submitted as #12502 . The `toolsrc` tree was extracted to https://github.com/microsoft/vcpkg-tool. `bootstrap.sh` was changed to download the right source tarball, extract, and build it. This was chosen over the previous attempt, a submodule, over concerns of accidentally destroying people's local modifications.
Diffstat (limited to 'toolsrc/src/vcpkg-test/platform-expression.cpp')
-rw-r--r--toolsrc/src/vcpkg-test/platform-expression.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/toolsrc/src/vcpkg-test/platform-expression.cpp b/toolsrc/src/vcpkg-test/platform-expression.cpp
deleted file mode 100644
index aef999230..000000000
--- a/toolsrc/src/vcpkg-test/platform-expression.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include <catch2/catch.hpp>
-
-#include <vcpkg/platform-expression.h>
-
-using vcpkg::StringView;
-using namespace vcpkg::PlatformExpression;
-
-static vcpkg::ExpectedS<Expr> parse_expr(StringView s)
-{
- return parse_platform_expression(s, MultipleBinaryOperators::Deny);
-}
-
-TEST_CASE ("platform-expression-identifier", "[platform-expression]")
-{
- auto m_expr = parse_expr("windows");
- REQUIRE(m_expr);
- auto& expr = *m_expr.get();
-
- CHECK(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}}));
- CHECK(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "WindowsStore"}}));
- CHECK_FALSE(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "Linux"}}));
- CHECK_FALSE(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "Darwin"}}));
-}
-
-TEST_CASE ("platform-expression-not", "[platform-expression]")
-{
- auto m_expr = parse_expr("!windows");
- REQUIRE(m_expr);
- auto& expr = *m_expr.get();
-
- CHECK_FALSE(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}}));
- CHECK_FALSE(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "WindowsStore"}}));
- CHECK(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "Linux"}}));
- CHECK(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "Darwin"}}));
-}
-
-TEST_CASE ("platform-expression-and", "[platform-expression]")
-{
- auto m_expr = parse_expr("!windows & !arm");
- REQUIRE(m_expr);
- auto& expr = *m_expr.get();
-
- CHECK_FALSE(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}}));
- CHECK_FALSE(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "WindowsStore"}}));
- CHECK(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "Linux"}}));
- CHECK_FALSE(expr.evaluate({
- {"VCPKG_CMAKE_SYSTEM_NAME", "Linux"},
- {"VCPKG_TARGET_ARCHITECTURE", "arm"},
- }));
-}
-
-TEST_CASE ("platform-expression-or", "[platform-expression]")
-{
- auto m_expr = parse_expr("!windows | arm");
- REQUIRE(m_expr);
- auto& expr = *m_expr.get();
-
- CHECK_FALSE(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}}));
- CHECK(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "arm"}}));
- CHECK(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "Linux"}}));
-}
-
-TEST_CASE ("weird platform-expressions whitespace", "[platform-expression]")
-{
- auto m_expr = parse_expr(" ! \t windows \n| arm \r");
- REQUIRE(m_expr);
- auto& expr = *m_expr.get();
-
- CHECK_FALSE(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}}));
- CHECK(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "arm"}}));
- CHECK(expr.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "Linux"}}));
-}
-
-TEST_CASE ("no mixing &, | in platform expressions", "[platform-expression]")
-{
- auto m_expr = parse_expr("windows & arm | linux");
- CHECK_FALSE(m_expr);
- m_expr = parse_expr("windows | !arm & linux");
- CHECK_FALSE(m_expr);
-}