One of my projects uses the config in
mix.exs during compilation to specialise the generation of a set of functions. But I’m not sure how to test this part of the app since the app is compiled before tests run (of course).
Any ideas on how to build a test harness that will allow me to change configuration, recompile and then run tests?
Use case: My lib reads json files representing a locale definition (number formats, date/time formats, pluralisation and so on) during compilation. To optimise performance, I read these files at compile time, do some parsing and generate a bunch of functions. There are 514 locales so doing this for the full data set isn’t helpful except for testing. So the required locales are configured in
mix.exs and only those locales are compiled into the code. When a requested locale is configured but not available it is also downloaded and then processed. I need to test changing the configuration, confirming unit tests and testing locale downloading.