From 2e802ff453ea503057d9090715c55ce6e28c5408 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 7 Mar 2024 11:37:01 +0100 Subject: [PATCH] Rename new function --- cpp/src/arrow/filesystem/filesystem_test.cc | 28 ++++++++++----------- cpp/src/arrow/filesystem/gcsfs.cc | 2 +- cpp/src/arrow/filesystem/path_util.cc | 2 +- cpp/src/arrow/filesystem/path_util.h | 6 ++--- cpp/src/arrow/filesystem/s3fs.cc | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cpp/src/arrow/filesystem/filesystem_test.cc b/cpp/src/arrow/filesystem/filesystem_test.cc index 4c650b7b7680e..8477647b2cd73 100644 --- a/cpp/src/arrow/filesystem/filesystem_test.cc +++ b/cpp/src/arrow/filesystem/filesystem_test.cc @@ -152,32 +152,32 @@ TEST(PathUtil, GetAbstractPathParent) { AssertPairEqual(pair, {"abc", "def\\ghi"}); } -TEST(PathUtil, ValidateAbstractPathPartsString) { - ASSERT_OK(ValidateAbstractPathParts("")); - ASSERT_OK(ValidateAbstractPathParts("abc")); - ASSERT_OK(ValidateAbstractPathParts("abc/def")); - ASSERT_OK(ValidateAbstractPathParts("abc/def.ghi")); - ASSERT_OK(ValidateAbstractPathParts("abc/def\\ghi")); +TEST(PathUtil, ValidateAbstractPath) { + ASSERT_OK(ValidateAbstractPath("")); + ASSERT_OK(ValidateAbstractPath("abc")); + ASSERT_OK(ValidateAbstractPath("abc/def")); + ASSERT_OK(ValidateAbstractPath("abc/def.ghi")); + ASSERT_OK(ValidateAbstractPath("abc/def\\ghi")); // Extraneous separators - ASSERT_RAISES(Invalid, ValidateAbstractPathParts("//")); - ASSERT_RAISES(Invalid, ValidateAbstractPathParts("abc//def")); + ASSERT_RAISES(Invalid, ValidateAbstractPath("//")); + ASSERT_RAISES(Invalid, ValidateAbstractPath("abc//def")); } -TEST(PathUtil, ValidateAbstractPathPartsVector) { - ASSERT_OK(ValidateAbstractPathParts(std::vector{})); - ASSERT_OK(ValidateAbstractPathParts(std::vector{"abc"})); +TEST(PathUtil, ValidateAbstractPathParts) { + ASSERT_OK(ValidateAbstractPathParts({})); + ASSERT_OK(ValidateAbstractPathParts({"abc"})); ASSERT_OK(ValidateAbstractPathParts({"abc", "def"})); ASSERT_OK(ValidateAbstractPathParts({"abc", "def.ghi"})); ASSERT_OK(ValidateAbstractPathParts({"abc", "def\\ghi"})); // Empty path component - ASSERT_RAISES(Invalid, ValidateAbstractPathParts(std::vector{""})); + ASSERT_RAISES(Invalid, ValidateAbstractPathParts({""})); ASSERT_RAISES(Invalid, ValidateAbstractPathParts({"abc", "", "def"})); // Separator in component - ASSERT_RAISES(Invalid, ValidateAbstractPathParts(std::vector{"/"})); - ASSERT_RAISES(Invalid, ValidateAbstractPathParts(std::vector{"abc/def"})); + ASSERT_RAISES(Invalid, ValidateAbstractPathParts({"/"})); + ASSERT_RAISES(Invalid, ValidateAbstractPathParts({"abc/def"})); } TEST(PathUtil, ConcatAbstractPath) { diff --git a/cpp/src/arrow/filesystem/gcsfs.cc b/cpp/src/arrow/filesystem/gcsfs.cc index c935a2b1395ca..1f091e980bf97 100644 --- a/cpp/src/arrow/filesystem/gcsfs.cc +++ b/cpp/src/arrow/filesystem/gcsfs.cc @@ -78,7 +78,7 @@ struct GcsPath { } static Status Validate(const GcsPath& path) { - auto st = internal::ValidateAbstractPathParts(path.full_path); + auto st = internal::ValidateAbstractPath(path.full_path); if (!st.ok()) { return Status::Invalid(st.message(), " in path ", path.full_path); } diff --git a/cpp/src/arrow/filesystem/path_util.cc b/cpp/src/arrow/filesystem/path_util.cc index 05c1b50fd5f64..f38537e59f426 100644 --- a/cpp/src/arrow/filesystem/path_util.cc +++ b/cpp/src/arrow/filesystem/path_util.cc @@ -137,7 +137,7 @@ Status ValidateAbstractPathParts(const std::vector& parts) { return Status::OK(); } -Status ValidateAbstractPathParts(std::string_view path) { +Status ValidateAbstractPath(std::string_view path) { auto pos = path.find_first_of(kSep); while (pos != path.npos) { ++pos; diff --git a/cpp/src/arrow/filesystem/path_util.h b/cpp/src/arrow/filesystem/path_util.h index 14918c1ceadbc..d49d9d2efa7f6 100644 --- a/cpp/src/arrow/filesystem/path_util.h +++ b/cpp/src/arrow/filesystem/path_util.h @@ -63,13 +63,13 @@ ARROW_EXPORT int GetAbstractPathDepth(std::string_view path); ARROW_EXPORT std::pair GetAbstractPathParent(const std::string& s); -// Validate the components of an abstract path. +// Validate an abstract path. ARROW_EXPORT -Status ValidateAbstractPathParts(const std::vector& parts); +Status ValidateAbstractPath(std::string_view path); // Validate the components of an abstract path. ARROW_EXPORT -Status ValidateAbstractPathParts(std::string_view path); +Status ValidateAbstractPathParts(const std::vector& parts); // Append a non-empty stem to an abstract path. ARROW_EXPORT diff --git a/cpp/src/arrow/filesystem/s3fs.cc b/cpp/src/arrow/filesystem/s3fs.cc index a58fade9ae84c..9c4d08b5cdf1b 100644 --- a/cpp/src/arrow/filesystem/s3fs.cc +++ b/cpp/src/arrow/filesystem/s3fs.cc @@ -481,7 +481,7 @@ struct S3Path { } static Status Validate(const S3Path& path) { - auto st = internal::ValidateAbstractPathParts(path.full_path); + auto st = internal::ValidateAbstractPath(path.full_path); if (!st.ok()) { return Status::Invalid(st.message(), " in path ", path.full_path); }