anjakefala commented on code in PR #34170:
URL: https://github.com/apache/arrow/pull/34170#discussion_r1117839311


##########
cpp/src/arrow/filesystem/localfs_test.cc:
##########
@@ -472,6 +472,55 @@ TYPED_TEST(TestLocalFS, StressGetFileInfoGenerator) {
   }
 }
 
+TYPED_TEST(TestLocalFS, NeedsExtendedFileInfo) {
+  ASSERT_OK(this->fs_->CreateDir("AB/CD"));
+  CreateFile(this->fs_.get(), "AB/ab", "data");
+
+  FileSelector selector;
+  selector.base_dir = "";
+  selector.needs_extended_file_info = false;
+  std::vector<FileInfo> infos;
+
+  ASSERT_OK_AND_ASSIGN(infos, this->fs_->GetFileInfo(selector));
+  ASSERT_EQ(infos.size(), 1);
+
+  for (FileInfo info : infos) {
+    if (info.path() == "AB") {
+      AssertFileInfo(info, "AB", FileType::Directory);
+    } else {
+      // TODO how would I raise an error in a test?
+      ASSERT_TRUE(false);
+    }
+
+    ASSERT_EQ(info.size(), kNoSize);
+    ASSERT_EQ(info.mtime(), kNoTime);
+  }
+
+  selector.recursive = true;
+  ASSERT_OK_AND_ASSIGN(infos, this->fs_->GetFileInfo(selector));
+  ASSERT_EQ(infos.size(), 3);
+
+  for (FileInfo info : infos) {
+    if (info.path() == "AB") {
+      AssertFileInfo(info, "AB", FileType::Directory);
+    } else if (info.path() == "AB/CD") {
+      AssertFileInfo(info, "AB/CD", FileType::Directory);
+    } else if (info.path() == "AB/ab") {
+      AssertFileInfo(info, "AB/ab", FileType::File);
+    } else {
+      // TODO how would I raise an error in a test?
+      ASSERT_TRUE(false);
+    }

Review Comment:
   Ah, I could not find an example of how inconsistent ordering was handled 
with the `FileSelector` case! Thank you!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to