-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Describe the enhancement requested
Now, our build system has GoogleTest support but it's not used. There is only a placeholder test that tests nothing.
We had one test for mex_util but it removed by GH-37204.
We use the MATLAB's testing framework for all tests.
The GoogleTest support needs non-trivial CMake codes. If we can drop the GoogleTest support, we can reduce maintenance cost for it and reduce build time of the MATLAB bindings.
But we have the following use-case of the GoogleTest support:
I think we want to keep the GoogleTest support for now because we do plan on adding C++ unit tests. There are a few error-conditions that cannot be triggered from MATLAB for which we want to add C++ unit tests.
Can we use another approach for the use-case?
For example, can we write a C++ method that causes an error-condition and register the method to MATLAB?
diff --git a/matlab/src/cpp/arrow/matlab/array/proxy/array.cc b/matlab/src/cpp/arrow/matlab/array/proxy/array.cc
index 9dc14c341..cedb58793 100644
--- a/matlab/src/cpp/arrow/matlab/array/proxy/array.cc
+++ b/matlab/src/cpp/arrow/matlab/array/proxy/array.cc
@@ -37,6 +37,9 @@ namespace arrow::matlab::array::proxy {
REGISTER_METHOD(Array, type);
REGISTER_METHOD(Array, isEqual);
+#ifdef ARROW_MATLAB_TEST
+ REGISTER_METHOD(Array, errorA);
+#endif
}
std::shared_ptr<arrow::Array> Array::unwrap() {
@@ -115,4 +118,11 @@ namespace arrow::matlab::array::proxy {
mda::ArrayFactory factory;
context.outputs[0] = factory.createScalar(is_equal);
}
+
+#ifdef ARROW_MATLAB_TEST
+ void Array::errorA(libmexclass::proxy::method::Context& context) {
+ auto errorCondition = arrow::Status::Invalid("error A!");
+ MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(errorCondition, context, ...ERROR_ID);
+ }
+#endif
}If we can call the method from MATLAB, can we assert it by the MATLAB testing framework?
FYI: We removed GoogleTest dependency from PyArrow by GH-14117/GH-32328 because maintaining GoogleTest support in python/ was high cost for us.
only when
Component(s)
MATLAB
Metadata
Metadata
Assignees
Type
Projects
Status