This post demonstrates refactoring a Fortran test framework to use custom types for returning test and assertion errors instead of simple boolean values. It introduces `assertion_failed_t` and `test_failed_t` types to carry error messages from assertions through tests to the test runner, enabling better error reporting. The implementation uses allocatable return types to make errors optional, type extension for compatibility, and optional custom messages for additional context in test failures.

7m read timeFrom matthiasnoback.nl
Post cover image
Table of contents
Printing the test error using the progress printerAdding custom messages

Sort: