bkietz opened a new issue, #565:
URL: https://github.com/apache/arrow-nanoarrow/issues/565
Many functions in nanoarrow accept an `ArrowError*` which receives a message
describing the error; frequently more informative than the `ArrowErrorCode`.
Although there are tests asserting error message content, most other tests
ignore the error message entirely. This can make debugging those other tests
frustrating and leads to ad-hoc assertions like
```c++
EXPECT_EQ(ArrowIpcDecoderVerifyHeader(&decoder, data, &error),
NANOARROW_OK)
<< error.message;
```
There are a couple of GTest tricks we could use to be more ergonomic, like
defining a new assertion macro:
```c++
TEST(Foo, Bar) {
// ...
// Just check that the error code is NANOARROW_OK:
EXPECT_OK(ArrowSchemaViewInit(&schema_view, &schema, nullptr));
// ... or also if the code is anything else, append error->message to the
assertion
EXPECT_OK(ArrowSchemaViewInit(&schema_view, &schema, &error), &error);
}
```
It'd even be possible to elide the extra macro argument by introducing a C++
wrapper for ArrowError:
```c++
TEST(Foo, Bar) {
// ...
nanoarrow::UniqueError error;
EXPECT_OK(ArrowSchemaViewInit(&schema_view, &schema, &error)); // no
repetitive argument
EXPECT_OK(ArrowSchemaViewInit(&schema_view, &schema, nullptr)); // still
fine
}
```
--
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]