You can find more general developer documentation at TulipaEnergyModel's README.dev.md. Here you will find more specific information.
We should also test error handling, this is particularly important
since TulipaIO
is user-facing. We follow two principles:
-
throw a relevant
Exception
, if one doesn't exist, we can create one that emits a relevant message; seeexceptions.jl
and its uses in the codebase. -
to test an exception, we test both the exception type, and the generated message. This is done with
@test_throws
. While testing the type has been supported in Julia 1.6 (LTS), unfortunately testing the message has only been supported since Julia 1.8, also the test has to be done by repeating the error. So the guideline is to test exceptions like this example fromtest-pipeline.jl
:@test_throws DimensionMismatch TIO.set_tbl_col(args...; opts...) if (VERSION.major >= 1) && (VERSION.minor >= 8) @test_throws [r"Length.+different", r"index.+value"] TIO.set_tbl_col(args...; opts...) end