fallintoplace commented on code in PR #7807:
URL: https://github.com/apache/opendal/pull/7807#discussion_r3487694843


##########
bindings/c/tests/bdd.cpp:
##########
@@ -138,3 +138,110 @@ TEST_F(OpendalBddTest, FeatureTest)
     error = opendal_operator_delete(this->p, "tmpdir/");
     EXPECT_EQ(error, nullptr);
 }
+
+TEST_F(OpendalBddTest, WriteEmptyNullBytes)
+{
+    const opendal_bytes empty = {
+        .data = nullptr,
+        .len = 0,
+        .capacity = 0,
+    };
+
+    opendal_error* error = opendal_operator_write(this->p, "empty", &empty);
+    EXPECT_EQ(error, nullptr);
+
+    opendal_result_read read = opendal_operator_read(this->p, "empty");
+    EXPECT_EQ(read.error, nullptr);
+    EXPECT_EQ(read.data.len, 0);
+    opendal_bytes_free(&read.data);
+
+    error = opendal_operator_write_with(this->p, "empty-with-options", &empty, 
nullptr);
+    EXPECT_EQ(error, nullptr);
+
+    read = opendal_operator_read(this->p, "empty-with-options");

Review Comment:
   It’s covering opendal_operator_write_with specifically. This patch adds the 
same opendal_bytes validation to both opendal_operator_write and 
opendal_operator_write_with, so I wanted one happy-path check for each public 
write entry point plus the writer path. Since opts is NULL here, it isn’t 
testing options behavior, only that empty-null buffers are accepted through the 
write_with API as well



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