Files
OpenAssetTools/test/CommonTests/Utils/FileUtilsTests.cpp
T
wroyandJan Laupetin 63e6d57b9c fix: Keep search paths in the specified order (#1069)
* fix: Keep search paths in the specified order

* chore: remove namespaces from tests

* fix: alphabetical order in linker default paths for backwards compatibility

* chore: extract AddPathsStringIfDistinct function

* chore: make sure linker default source search path stays backwards compatible

---------

Co-authored-by: Jan Laupetin <[email protected]>
2026-11-01 19:28:16 +01:00

22 lines
682 B
C++

#include "Utils/FileUtils.h"
#include <catch2/catch_test_macros.hpp>
#include <string>
#include <vector>
TEST_CASE("FileUtils: Parses paths string in specified order", "[fileutils]")
{
std::vector<std::string> paths;
REQUIRE(utils::ParsePathsString("zone_raw/b;zone_raw/a;\"raw;c\"", paths));
REQUIRE(paths == std::vector<std::string>{"zone_raw/b", "zone_raw/a", "raw;c"});
}
TEST_CASE("FileUtils: Parses paths string keeping first of duplicate paths", "[fileutils]")
{
std::vector<std::string> paths{"raw"};
REQUIRE(utils::ParsePathsString("zone_raw;raw;zone_raw;lang", paths));
REQUIRE(paths == std::vector<std::string>{"raw", "zone_raw", "lang"});
}