This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch refactor-lister
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git

commit 870a46aac67e2e6d294cfc5ba526cab2c994dfc2
Author: Xuanwo <[email protected]>
AuthorDate: Thu Dec 7 15:20:07 2023 +0800

    Add list nest dir test
    
    Signed-off-by: Xuanwo <[email protected]>
---
 core/tests/behavior/list.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/tests/behavior/list.rs b/core/tests/behavior/list.rs
index 64911f8fa..17f4a695a 100644
--- a/core/tests/behavior/list.rs
+++ b/core/tests/behavior/list.rs
@@ -261,7 +261,8 @@ pub async fn test_list_sub_dir(op: Operator) -> Result<()> {
 
 /// List dir should also to list nested dir.
 pub async fn test_list_nested_dir(op: Operator) -> Result<()> {
-    let dir = format!("{}/{}/", uuid::Uuid::new_v4(), uuid::Uuid::new_v4());
+    let parent = format!("{}/", uuid::Uuid::new_v4());
+    let dir = format!("{parent}{}/", uuid::Uuid::new_v4());
 
     let file_name = uuid::Uuid::new_v4().to_string();
     let file_path = format!("{dir}{file_name}");
@@ -274,6 +275,11 @@ pub async fn test_list_nested_dir(op: Operator) -> 
Result<()> {
         .expect("creat must succeed");
     op.create_dir(&dir_path).await.expect("creat must succeed");
 
+    let obs = op.list(&parent).await?;
+    assert_eq!(obs.len(), 1, "parent should only got 1 entry");
+    assert_eq!(obs[0].path(), dir);
+    assert_eq!(obs[0].metadata().mode(), EntryMode::DIR);
+
     let mut obs = op.lister(&dir).await?;
     let mut objects = HashMap::new();
 

Reply via email to