<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/fortran---testing---returning-test-and-assertion-errors-otpskfuxh" -->

---
title: Fortran - Testing - Returning test and assertion errors
description: This post demonstrates refactoring a Fortran test framework to use custom types for returning test and assertion errors instead of simple boolean values. It...
canonical: https://daily.dev/posts/fortran---testing---returning-test-and-assertion-errors-otpskfuxh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Fortran - Testing - Returning test and assertion errors | daily.dev
og:description: This post demonstrates refactoring a Fortran test framework to use custom types for returning test and assertion errors instead of simple boolean values. It...
og:url: https://daily.dev/posts/fortran---testing---returning-test-and-assertion-errors-otpskfuxh
og:image: https://api.daily.dev/og/posts/OtPskfUXH.png
og:image:alt: Fortran - Testing - Returning test and assertion errors
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Fortran - Testing - Returning test and assertion errors

**[Matthias Noback](https://daily.dev/sources/matthiasnoback)** · 7 min read · 0 upvotes · 0 comments

## Summary

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.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://matthiasnoback.nl/2026/01/fortran-testing-returning-test-and-assertion-errors/>

## Similar posts on daily.dev

- [Fortran - Testing - Improving the design of the test framework - Part 1](https://daily.dev/posts/fortran---testing---improving-the-design-of-the-test-framework---part-1-m80zedwgr) · Matthias Noback · 0 upvotes · 0 comments
- [Fortran - Testing - More assertion functions](https://daily.dev/posts/fortran---testing---more-assertion-functions-cxmqx7aok) · Matthias Noback · 0 upvotes · 0 comments
- [Fortran - Testing - Improving temporary test programs](https://daily.dev/posts/fortran---testing---improving-temporary-test-programs-6pcwovvdd) · Matthias Noback · 0 upvotes · 0 comments
- [Fortran - Testing - Towards a generic, testable test runner](https://daily.dev/posts/fortran---testing---towards-a-generic-testable-test-runner-hydk4tgry) · Matthias Noback · 0 upvotes · 0 comments
- [Fortran - Testing - Unit tests and test suites](https://daily.dev/posts/fortran---testing---unit-tests-and-test-suites-lsy5kj9un) · Matthias Noback · 0 upvotes · 0 comments

---

Tags: [#fortran](https://daily.dev/tags/fortran), [#testing](https://daily.dev/tags/testing)

[View this post on daily.dev](https://daily.dev/posts/fortran---testing---returning-test-and-assertion-errors-otpskfuxh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Fortran - Testing - Returning test and assertion errors","url":"https://daily.dev/posts/fortran---testing---returning-test-and-assertion-errors-otpskfuxh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/fortran---testing---returning-test-and-assertion-errors-otpskfuxh"},"datePublished":"2026-01-28T18:55:54.622Z","dateModified":"2026-04-10T02:14:08.286Z","description":"This post demonstrates refactoring a Fortran test framework to use custom types for returning test and assertion errors instead of simple boolean values. It...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/43a19ee9cc932e491d34baa83a8a5d9f?_a=AQAEulh","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/43a19ee9cc932e491d34baa83a8a5d9f?_a=AQAEulh","isAccessibleForFree":true,"articleSection":"Matthias Noback","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Matthias Noback","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/362833f5f11a4feb859e90f12dc09fa8","url":"https://daily.dev/sources/matthiasnoback"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/fortran---testing---returning-test-and-assertion-errors-otpskfuxh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"fortran,testing","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Matthias Noback","item":"https://daily.dev/sources/matthiasnoback"},{"@type":"ListItem","position":3,"name":"Fortran - Testing - Returning test and assertion errors"}]}
```

