forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArchive.cpp
More file actions
34 lines (26 loc) · 983 Bytes
/
Copy pathArchive.cpp
File metadata and controls
34 lines (26 loc) · 983 Bytes
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
28
29
30
31
32
33
34
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "pch.h"
#include "TestCommon.h"
#include <winget/Archive.h>
using namespace AppInstaller::Archive;
using namespace TestCommon;
constexpr std::string_view s_ZipFile = "TestZip.zip";
TEST_CASE("Extract_ZipArchive", "[archive]")
{
TestCommon::TempDirectory tempDirectory("TempDirectory");
TestDataFile testZip(s_ZipFile);
const auto& testZipPath = testZip.GetPath();
const auto& tempDirectoryPath = tempDirectory.GetPath();
HRESULT hr = TryExtractArchive(testZipPath, tempDirectoryPath);
std::filesystem::path expectedPath = tempDirectoryPath / "test.txt";
REQUIRE(SUCCEEDED(hr));
REQUIRE(std::filesystem::exists(expectedPath));
}
TEST_CASE("Scan_ZipArchive", "[archive]")
{
TestDataFile testZip(s_ZipFile);
const auto& testZipPath = testZip.GetPath();
bool result = ScanZipFile(testZipPath);
REQUIRE(result);
}