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


##########
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:
   Instead of this if loop, perhaps you could use `SortInfos` like the other 
tests and assert equality of each element. See example here:
   
   
https://github.com/apache/arrow/blob/9651563d6e8d34ddd43d5882de8134393590d4ce/cpp/src/arrow/filesystem/s3fs_test.cc#L730-L735
   
   Same applies to the earlier for loop.



-- 
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