aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg-test/commands.create.cpp
blob: 0cc93bd57652fb05402e9d94ae0648a64d835abd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <catch2/catch.hpp>

#include <vcpkg/base/files.h>

#include <vcpkg/commands.create.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>

#include <iterator>
#include <string>

TEST_CASE ("create smoke test", "[commands-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);
}