Hide
Scraps
RSS

Writing tests for Nim libraries with Nimble and unittest

11th July 2025

Most developers will agree that having automatic tests is a good thing. With good tests we can make changes to our code and test whether these changes causes old bugs to resurface, new bugs to appear, or current workflows to be broken.

In this tutorial we will have a look at how the default testing setup works in Nimble, the official Nim package manager/build tool which is installed along Nim.

nimble init

When you first create a…


Building an epaper laptop: The monitor

2nd July 2025

The most distinct part of making an epaper laptop is obviously the screen. And picking a screen for this project was always going to be one of the most critical decisions. The biggest available panel I could find with a somewhat reasonable price was a 10.3” Waveshare panel that also shipped as a separate HDMI screen. Since the panel would always be a big expenditure having the comfort of knowing I could always fall back to just using…


Building an epaper laptop

14th March 2025

Ever since I got my first ereader twelve years ago I’ve wanted an epaper laptop. The allure of a laptop which would work in direct sunlight and has incredible battery life has always drawn me. Sure, laptops have come a long way in the past twelve years, especially the battery life aspect has gotten much better. But there’s still nothing which beats epaper when it comes to the direct sunlight application. Whether or not I…


Labelled exceptions for smoother error handling

1st November 2023

Error handling, a contentious and oft-discussed topic. Each language has some way of dealing with errors, be it error codes, result types, exceptions, something entirely different, or a mix. How to properly deal with things going wrong in our programs has been important pretty much ever since we started writing programs. Papers have been written about it, talks have been held on the topic, and countless libraries have been written to bring one languages way…


Teaching old C code new tricks with Nim

8th September 2023

Recently I was met with an interesting problem when wrapping a C library in Nim. The library in question was MAPM, an older but quite complete library for dealing with arbitrary precision maths. Unfortunately the library doesn’t have much in the way of error handling. If something goes wrong it almost always writes to stderr and returns the number 0. And to be fair, there isn’t a whole lot that can go wrong in…