From d2333bbcf34193d340e39fcca444dd8f1c9412f9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 21 Sep 2023 21:40:16 -0400 Subject: Use anonymous namespace in C++ test --- test/cpp/test_path_std.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'test/cpp') diff --git a/test/cpp/test_path_std.cpp b/test/cpp/test_path_std.cpp index 6c0e450..db38cfa 100644 --- a/test/cpp/test_path_std.cpp +++ b/test/cpp/test_path_std.cpp @@ -19,12 +19,14 @@ #include #include +namespace { + struct BinaryCase { const char* lhs; const char* rhs; }; -static const BinaryCase joins[] = { +const BinaryCase joins[] = { {"", ""}, {"", "/b/"}, {"", "b"}, {"/", ""}, {"..", ".."}, {"..", "name"}, {"..", "/"}, {"/", ".."}, {"/", nullptr}, {"//host", ""}, {"//host", "a"}, {"//host/", "a"}, @@ -45,7 +47,7 @@ static const BinaryCase joins[] = { {nullptr, "/b/c"}, {nullptr, "b"}, {nullptr, "b/c"}, {nullptr, nullptr}, }; -static const BinaryCase lexical_relatives[] = { +const BinaryCase lexical_relatives[] = { {"", ""}, {"", "."}, {".", "."}, @@ -127,7 +129,7 @@ static const BinaryCase lexical_relatives[] = { #endif }; -static const char* const paths[] = { +const char* const paths[] = { // Valid paths handled consistently on all platforms "", ".", @@ -396,7 +398,7 @@ static const char* const paths[] = { }; /// Abort if `path` doesn't match `result` when loosely parsed -static bool +bool match(const std::filesystem::path& path, char* const result) { const bool success = (path.empty() && !result) || (result && path == result); @@ -406,7 +408,7 @@ match(const std::filesystem::path& path, char* const result) } /// Abort if `path` doesn't equal `result` -static bool +bool equal(const std::filesystem::path& path, char* const result) { const bool success = @@ -417,7 +419,7 @@ equal(const std::filesystem::path& path, char* const result) } /// Abort if `path` doesn't match `view` when loosely parsed -static bool +bool match(const std::filesystem::path& path, const ZixStringView view) { return (path.empty() && !view.length) || @@ -425,7 +427,7 @@ match(const std::filesystem::path& path, const ZixStringView view) } /// Abort if `path` doesn't equal `view` -static bool +bool equal(const std::filesystem::path& path, const ZixStringView view) { return (path.empty() && !view.length) || @@ -433,7 +435,7 @@ equal(const std::filesystem::path& path, const ZixStringView view) path.u8string() == std::string{view.data, view.length}); } -static void +void run() { using Path = std::filesystem::path; @@ -494,6 +496,8 @@ run() } } +} // namespace + int main() { -- cgit v1.2.1