Unidata / netcdf-cxx4

Official GitHub repository for netCDF-C++ libraries and utilities.
Other
124 stars 49 forks source link

Report test errors correctly #122

Closed ZedThree closed 2 years ago

ZedThree commented 2 years ago

Most of the tests were catching exceptions are calling e.what() and discarding the result. Also, a lot of the tests were returning e.errorCode(), but unfortunately throwing the form of NcException where e.errorCode() == 0.

Two things to consider:

  1. defaulting NcException::ec to EXIT_FAILURE or other non-zero value.
  2. using a testing framework like googletest or catch2. The current tests report a maximum of one error per test, but with one of those frameworks, multiple errors could be caught per run.