mirror of
https://github.com/gulrak/filesystem.git
synced 2026-07-30 16:26:11 +08:00
Refine weakly_canonical test to validate error codes and handle invalid paths more robustly.
This commit is contained in:
parent
21b931bd97
commit
a6aab92fb2
@ -2868,12 +2868,19 @@ TEST_CASE("fs.op.weakly_canonical - weakly_canonical", "[filesystem][operations]
|
||||
CHECK(!ec);
|
||||
|
||||
const auto invalid = dir / std::string(1024, 'x');
|
||||
std::error_code lookupError;
|
||||
CHECK_FALSE(fs::exists(invalid, lookupError));
|
||||
#ifndef GHC_OS_WINDOWS
|
||||
REQUIRE(lookupError);
|
||||
#endif
|
||||
if (lookupError) {
|
||||
CHECK(fs::weakly_canonical(invalid, ec).empty());
|
||||
CHECK(ec);
|
||||
CHECK(ec == lookupError);
|
||||
#ifdef GHC_WITH_EXCEPTIONS
|
||||
CHECK_THROWS_AS(fs::weakly_canonical(invalid), fs::filesystem_error);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("std::string_view support", "[filesystem][fs.string_view]")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user