Best approach for mocking struct methods with different behavior in tests

You also could use build options to pass in the value and make it changeable from the outside.

Alternatively you could import a module @import("settings") and then use the build system to switch between two different implementations for that module, or even generate one of them (build options are one way to generate a module of imported options).

This is related: