diff options
| author | Billy O'Neal <bion@microsoft.com> | 2020-06-16 11:58:11 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-16 11:58:11 -0700 |
| commit | 04e214eb0ef9cd5fc4308dd7a43943e98ae1d534 (patch) | |
| tree | e11b55a563310307a553811877f6cae21633afd1 /toolsrc/src/vcpkg-test/commands.create.cpp | |
| parent | 7192d3affa4b1d8f88e3e730eb561612c24f7d78 (diff) | |
| download | vcpkg-04e214eb0ef9cd5fc4308dd7a43943e98ae1d534.tar.gz vcpkg-04e214eb0ef9cd5fc4308dd7a43943e98ae1d534.zip | |
[vcpkg] Fix create by extracting common paths settings (#11842)
Resolves #11784
Diffstat (limited to 'toolsrc/src/vcpkg-test/commands.create.cpp')
| -rw-r--r-- | toolsrc/src/vcpkg-test/commands.create.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/toolsrc/src/vcpkg-test/commands.create.cpp b/toolsrc/src/vcpkg-test/commands.create.cpp new file mode 100644 index 000000000..993be142b --- /dev/null +++ b/toolsrc/src/vcpkg-test/commands.create.cpp @@ -0,0 +1,25 @@ +#include <catch2/catch.hpp> + +#include <string> +#include <iterator> +#include <vcpkg/base/files.h> +#include <vcpkg/commands.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +TEST_CASE ("smoke test", "[create]") +{ + using namespace vcpkg; + static const std::string argsRaw[] = {"create", "zlib2", "http://zlib.net/zlib-1.2.11.tar.gz", "zlib-1.2.11.zip"}; + + auto& fsWrapper = Files::get_real_filesystem(); + VcpkgCmdArguments args = VcpkgCmdArguments::create_from_arg_sequence(std::begin(argsRaw), std::end(argsRaw)); + VcpkgPaths paths(fsWrapper, args); + const auto exit_code = Commands::Create::perform(args, paths); + REQUIRE(exit_code == 0); + const auto expected_port = paths.ports / fs::u8path("zlib2"); + const auto expected_portfile_cmake = expected_port / fs::u8path("portfile.cmake"); + const auto lines = fsWrapper.read_lines(expected_portfile_cmake); + REQUIRE(lines.has_value()); + fsWrapper.remove_all(expected_port, ignore_errors); +} |
