updating test expectations

This commit is contained in:
Cœur 2025-04-13 16:07:22 +02:00 committed by Nathan Moinvaziri
parent c7b6cb09e9
commit 1eb579d9bc

View File

@ -11,6 +11,7 @@
#include "mz.h"
#include "mz_os.h"
#include <algorithm>
#include <gtest/gtest.h>
struct resolve_path_param {
@ -51,9 +52,17 @@ INSTANTIATE_TEST_SUITE_P(os, path_resolve, testing::ValuesIn(resolve_path_tests)
TEST_P(path_resolve, os) {
const auto &param = GetParam();
std::string path = param.path;
std::string expected_path = param.expected_path;
char output[256];
memset(output, 'z', sizeof(output));
mz_path_resolve(param.path, output, sizeof(output));
EXPECT_STREQ(output, param.expected_path);
// The expectation is that archiving+unarchiving data on a system should preserve its structure.
// So on Windows backslash should be preserved, while on UNIX slash should be preserved.
#ifndef _WIN32
std::replace(path.begin(), path.end(), '\\', '/');
std::replace(expected_path.begin(), expected_path.end(), '\\', '/');
#endif
mz_path_resolve(path.c_str(), output, sizeof(output));
EXPECT_STREQ(output, expected_path.c_str());
}